Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Note, Python's hash function is a very bad hash function. It usually maps sequential values (i.e. 1,2,3 ..) to sequential hash values (i.e. 1,2 3 ...) - yes, hash(1) = 1. The advantage of this is, if you have sequential keys (which is very common), you minimize collisions better than more "random" distributions.

Of course, you couldn't use it for cryptography.



If it was made that way by design, for that specific use, how can it be "very bad"?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: