Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of collisions with triplets of integers #12

Closed
GoogleCodeExporter opened this issue Apr 3, 2015 · 2 comments
Closed

Lots of collisions with triplets of integers #12

GoogleCodeExporter opened this issue Apr 3, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

I was interested in using a hash for integer arrays with few numbers in them.
So I searched for any collisions in a very sample case: unique triplets of 
numbers of the form (i,j,k) , where 1<= i< j < k <=255. The hash is calculated 
from the simple uint32_t array made with those 3 numbers. There are dozens of 
repetitions!

What steps will reproduce the problem?
-Run the enclosed C++ file
See the attached "sample output" for identified collisions.

Am I doing something wrong?

Original issue reported on code.google.com by par...@gmail.com on 10 Mar 2012 at 11:10

Attachments:

@GoogleCodeExporter
Copy link
Author

Unfortunately the laws of probability are against you - according to the 
Birthday Paradox, you'll probably see collisions in the results of an N-bit 
hash after hashing 2^(N/2) keys - for a 32-bit hash, that's 65536 keys. Your 
test code is hashing ~2.7 million keys, so you are bound to see collisions.

See http://en.wikipedia.org/wiki/Birthday_attack for interesting details.

Original comment by tanj...@gmail.com on 11 May 2012 at 6:08

@GoogleCodeExporter
Copy link
Author

Original comment by tanj...@gmail.com on 11 May 2012 at 6:08

  • Changed state: Invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant