Re:Dirty Coding Tricks
by donatj on Thursday January 08, 2015 @06:12PM
(#8859665)
I find th CRC collision story rather unbelievable.
[ Parent
| on HN ]
Re:Dirty Coding Tricks
by dietrichepp on Thursday January 08, 2015 @08:06PM
(#8860131)
Most people find this kind of thing unbelievable, which is why they call it a paradox (the "birthday paradox"). Assuming a perfect 64-bit hash, and "tens of thousands of files" meaning 20,000 files, the chance of collision is one in 46 billion.
However, if they reuse filenames, then the chance of collision is much higher. For example, assuming 1000 distinct filenames chosen at random, the chance of collision rises to about 1 in 10,000.
You see, shortly after leaving his boss's office and learning about the hidden-allocated 2MB, that guy implemented his own CRC that would throw the same hash just before release.
Maybe they were using 32-bit integers as their crc?
Apparently with CRC32 you only need about 77,000 items to have a 50% chance of a collision by birthday paradox.
It's not a "true" almost impossible collision that occurred, but two files that shared the same content and filename and would collide by definition.
They shared the filename, but the story says "even though they were completely different", IE, not the same content. It was a hash collision; certainly rare, but enough project with enough files around the world and it's bound to have happened to somebody.