tags:

views:

26

answers:

2

I'm a really newbie, so sorry if the title isn't grammatically correct :p Anyway...

Can I change a files md5 number using a batch file

+1  A: 

An MD5 checksum is calculated from the contents of the file. The only way you could change this using a batch file, would be to write a batch file which would modify the file.

If the file is text, you could simply echo some new contents to the end:

echo something >> $filename

If, however, the file is binary, this will lead to corruption.

If your question actually referred to the creation of MD5 checksums, you can obtain FCIV from Microsoft and use this within your batch: http://support.microsoft.com/kb/841290

Martin Eve
+1. Many binary file format allow appending any data to the file after the file terminator - that data is just ignored but appending causes MD5 to change (unless there's a collision of course).
sharptooth
+1  A: 

It's not clear at all which are your intents but a MD5 is associated with a set of bytes. You cannot change it without changing the bytes and recalculating it. This operation is one-way in the sense that you have your data, you use it to calc the MD5, you keep MD5 around with your file so that you can check the integrity whenever you need it.

This apporach requires the MD5 to be correct a not to be modified..

Jack