I am getting MD5 of several files using python function:
filehash = hashlib.md5(file)
print "FILE HASH: " + filehash.hexdigest()
though when I go to the terminal and do a
md5 file
the result I’m getting is not the same my python script is outputting (they don’t match). Any chance someone knows why?
hashlib.md5() takes the contents of the file not its name.
See http://docs.python.org/library/hashlib.html
You need to open the file, and read its contents before hashing it.