I like a lot of what Bob Jenkins writes, and I think(?) I may still be using his hash table library as my hash_t in my C code, but I still wouldn't use anything he designed in place of SHA256 or AES; so, just that word of caution.
That's appropriate, because hashing for hash tables has entirely different requirements than cryptographic hashing.
For a hash table you want a function that evaluates really fast, is short, but produces as little collisions as possible given that constraint.
A cryptographic hash can be slower and have more steps, but it should be extremely hard to find a plaintext with a pre-defined hash value, or produce collisions, or one of the many other threat scenarios.
i think it's worth pointing out the new murmurhash 3 for lookup table hashing, it has gone a long way and is supposed to be _really_ fast: http://code.google.com/p/smhasher/
The author of murmurhash actually based their work on Bob Jenkin's trying to make it speedier, and developed a nice hash test suite.
> Also, % can be extremely slow (230 times slower than addition on a Sparc).
This is surprising. For comparison, I did a test on my Intel Core 2 Duo. Modulo turned out to be about 8.5 times slower than addition. A lot better than Sparc, but it might still be to slow for certain applications.
5 comments
[ 3.7 ms ] story [ 22.1 ms ] threadFor a hash table you want a function that evaluates really fast, is short, but produces as little collisions as possible given that constraint.
A cryptographic hash can be slower and have more steps, but it should be extremely hard to find a plaintext with a pre-defined hash value, or produce collisions, or one of the many other threat scenarios.
The author of murmurhash actually based their work on Bob Jenkin's trying to make it speedier, and developed a nice hash test suite.
Google cache here : http://webcache.googleusercontent.com/search?client=ubuntu...
This is surprising. For comparison, I did a test on my Intel Core 2 Duo. Modulo turned out to be about 8.5 times slower than addition. A lot better than Sparc, but it might still be to slow for certain applications.