Quote:
Originally Posted by
fpmurphy
Yes. You will only get the same hash if both files are IDENTICAL in every way.
That's not STRICTLY correct, as any hash function effectively "compresses" data down to a fixed number of bits so there have to be collisions where different data produces identical hash results.
Hash functions try to make it impossible to modify data in ways to predictably produce a hash result identical to the result from the unmodified data. (Which is why when that protective ability is cracked, that hash function gets abandoned for more secure ones. FWIW,
cracks started appearing in md5 a long time ago and now it's effectively completely cracked. It's still useful for comparing data, though it's not really secure to validate it any more.)
So to be STRICTLY correct, when the hash results differ then the data differs. If the hash results are the same you need to check if the data differs.
(Yes, I've been spending a lot of time recently dealing with cryptography and hashes for a customer...)