Will changing a file name affect the MD5 Hash of a file?

Michael Shnitzer picture Michael Shnitzer · Feb 20, 2011 · Viewed 56.1k times · Source

Will changing a file name effect the MD5 Hash of a file?

Answer

jameshfisher picture jameshfisher · Jan 16, 2013

No, the hash is of the file contents only. You can see this in the source for md5sum and its MD5 implementation. You can also test this if you have access to md5sum:

$ echo "some arbitrary content" > file1
$ cp file1 file2
$ md5sum file1
f0007cbddd79de02179de7de12bec4e6  file1
$ md5sum file2
f0007cbddd79de02179de7de12bec4e6  file2
$