Overclockers Australia Forums

OCAU News - Wiki - QuickLinks - Pix - Sponsors  

Go Back   Overclockers Australia Forums > Software Topics > Windows Operating Systems

Notices


Sign up for a free OCAU account and this ad will go away!
Search our forums with Google:
Reply
 
Thread Tools
Old 22nd May 2005, 11:24 PM   #1
Myne_h Thread Starter
Member
 
Join Date: Feb 2002
Posts: 5,551
Default Using NTFS streams and md5 checksum for integrity checking

Sometimes I scare myself.

But
I figured some of you might find it useful somehow.

Some guy on atomic did a post about NTFS file streams : here

Anyway, the only thing I could think of NTFS streams being useful for is invisibly storing checksums to verify data integrity.

So I set about making a batch file to make, store and compare md5 checksums.
Personally I'm going to use it to ensure the integrity of large archived files
(only for ntfs obviously)


So, here it is :

"Md5s.bat" to be used in conjunction with md5sum.exe link

Code:
@Echo off
set a=0
set errors=0

if "%1"=="-c" goto %1
if "%1"=="-m" goto %1
echo.
Echo     Usage is " md5s.bat -m filename.ext " to create an md5 checksum
Echo     Or " md5s.bat -c filename.ext " to check the md5 checksum of a file 
echo     -c or -m MUST be present
echo.
goto end

:-m
for %%i in (%2) do (md5sum "%%i">"%%i":md5 || (set /a errors=errors+1 & echo. & Echo %%i ***********ERROR***********)
echo %%i done
set /a a=a+1
)
echo.
echo.
Echo ================================
echo %a% files checked
Echo %errors% Failed

goto end

:-c
for %%i in (%2) do (
md5sum -c "%%i":md5|| (set /a errors=errors+1 & echo. & Echo  ***********ERROR*********** & echo.)
set /a a=a+1
)
echo.
echo.
Echo ================================
echo %a% files checked
Echo %errors% Bad or missing Checksums
echo.

:end
copy that to md5s.bat and the md5sum.exe into your windows dir (or anywhere in the path variable)

md5c -m *.* will calculate the md5 for all files and save it to the file in an alternate filesystem stream called :md5

md5c -c *.* will calculate the md5's and compare them with the previously caculated md5 for that file

It works with individual filenames and with wildcards.


Please comment if you think it's useful.

Last edited by Myne_h; 22nd May 2005 at 11:35 PM.
Myne_h is offline   Reply With Quote

Join OCAU to remove this ad!
Reply

Bookmarks

Sign up for a free OCAU account and this ad will go away!

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time now is 4:07 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. -
OCAU is not responsible for the content of individual messages posted by others.
Other content copyright Overclockers Australia.
OCAU is hosted by Internode!