3 ms·
The probability of duplicates being low does not mean that you won't get duplicates. This is true for cryptographic hash functions, yet in practice no one has
by userbinator 11y ago
The probability of duplicates being low does not mean that you won't get duplicates.
This is true for cryptographic hash functions, yet in practice no one has a problem with using them for identifying files etc., because their output space is so large as to make the chance of a collision sufficiently low. I'm almost willing to bet that even for ones which are cryptographically insecure like MD5, and for which colliding pairs can be easily deliberately created, there hasn't been a truly accidental collision.
(Fun experiment to try: hash all the files you own, and then compare byte-by-byte the ones with the same hash. Try a few different cryptographic hash functions. If you do find accidental collisions, you've just experienced an event far more improbable than winning the lottery; and if it's SHA1, SHA256, or bigger, it's worth publicising this event.)
- ricardobeat 11y agoI have seen an md5 collision happen at work. Having low probability doesn't mean it won't happen, you just don't know when - people win the lottery around the world daily.
- deathanatos 11y agoDid you see a MD5 collision that happened randomly, or was someone intentionally trying to create one? Intentionally creating a collision with MD5 is fairly easy; having one happen at random would require creating something like 10 ^ 14 billion hashes in order to have the same chance of a collision as winning the lottery. People win the lottery, yes, but they don't happen across MD5 collisions by accident.
- ricardobeat 11y agoRandom! I don't remember the details, but we spent a good half hour looking up probabilities and marvelling at it. I think at the time nobody realized just how unlikely it was, should have saved the inputs :(
- userbinator 11y agoThat sounds like an interesting story. Consider yourself very lucky! Were the data being hashed related in some way, or user input (whereby someone could relatively easily feed in a collision pair)? If I came across an MD5 collision by accident, I'd certainly try to save the input pair, because such events are exceedingly rare. Owning a pair of entirely naturally occurring data with colliding MD5s is itself article-worthy, I think.