Does there exist a native Python implementation of the Jenkins hash algorithm(s)?
I need a hash algorithm that takes an arbitrary string and turns it into an 32-bit integer. For a given string, it must guarantee to return the same integer across platforms.
I have looked at the ELF hash algorithm, of which I have found a Python implementation. Could this be a suitable replacement given the above criteria? (http://www.partow.net/programming/hashfunctions/#ELFHashFunction)
Here a minimal implementation:
Ended up implementing it on my own. Released according to the original copyright notice (see below). Use at your own risk and have fun :-)
You can just use the first 32 bits of an md5sum
There is already a "jenkins" package on PyPi. But it is not "native" as the core implementation is in C.
a simple implementation form the one_at_a_time hash given at wikipedia. Mind this algorithm has an avalanche behavior.
This native python-code should give you the same hash as the original lookup3.c