According to this post MD5 is essentially unique provided they are not being malicious. I wonder, if you check a file for uniqueness by MD5 and File Size if it will always be unique even if people attempt to be malicious?
Asked
Active
Viewed 300 times
1 Answers
0
Quite simply put: no, it is not unique. From the post you quoted: "the probability of an accidental collision is still vanishingly small".
What do you mean by "essentially unique"? Uniqueness is binary: something is either unique or it is not. Since it is possible to have two files with the same MD5, the answer is "no, files of the same size will not always have different MD5s". Just "essentially" always they will ;)

GreenAsJade
- 14,459
- 11
- 63
- 98
-
I guess to clarify, the post says there is a very small chance with MD5 of a collision, which is fine providing you trust the person sending you the files. So in theory you could write something that brute forces an identical MD5 hash. I wondered if this would still be possible with the same file size, or if it was either literally impossible to create an identical MD5 for a file with the same size, or so incredibly difficult (eg. 500 years of computing) that it is effectively impossible. – NibblyPig Jan 20 '14 at 10:39
-
Actually, it is not fine even if you trust the person. You can (with vanishingly small probability) accidentally create two files with the same MD5 hash. Even if you trust me, that accident could happen to me. I think the key point here is that it does *not* take malicious intent for this to happen. If the consequence of it happening would be someone's death, you might consider not relying on not having an accidental collision. I think that your understanding of the situation is correct, but semantically the answer remains: no, the MD5 of a file is not unique, and accidents can happen. – GreenAsJade Jan 20 '14 at 10:43
-
1No idea, I didn't downvote you! Also I just discovered this which has a demonstration of two 64 byte files that generate the same hash! http://crypto.stackexchange.com/questions/1434/are-there-two-known-strings-which-have-the-same-md5-hash-value – NibblyPig Jan 22 '14 at 11:31