Frank DENIS random thoughts.

Bob Jenkins super fast hash for PHP

PHP’s built-in functions like md5() perform really poorly when it comes to using the hash for hash tables or for uniform load balancing.

Paul Hsieh’s hash is a very fast and popular hash function for that kind of job.

Last year, Bob Jekins compared a dozen of hash functions and designed its own (actually the third revision of it), that performs as fast as Paul Hsieh’s with less collisions

To make a long story short: this is probably the most efficient hash function known yet, as long as it is not used for cryptographic purpose. And it’s a pity that PHP doesn’t implement it.

It’s why I really wanted to spend a few minutes in order to create a PHP extension implementing that hash function.

Download the Jenkins hash extension for PHP and give it a try.

Preliminary benchmarks show that the Jenkins hash, as in the PHP extension, outperforms MD5 by 4 times, while still remaining a pretty good unique identifier.