Package com.linkedin.alpini.base.hash
Class JenkinsHashFunction
java.lang.Object
com.linkedin.alpini.base.hash.JenkinsHashFunction
- All Implemented Interfaces:
HashFunction
Hash algorithm by Bob Jenkins, 1996.
You may use this code any way you wish, private, educational, or commercial. It's free.
See: http://burtleburtle.net/bob/hash/doobs.html
Use for hash table lookup, or anything where one collision in 2^^32
is acceptable. Do NOT use for cryptographic purposes.
Reimplementation from http://burtleburtle.net/bob/c/lookup3.c to match test vectors
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonghash(byte[] key, int numBuckets) longhash(long key, int numBuckets) longhash(ByteBuffer buf) longhash(ByteBuffer buf, int off, int len) inthashlittle(ByteBuffer k, int initval) longhashlittle2(ByteBuffer k, long initval) intlong
-
Constructor Details
-
JenkinsHashFunction
public JenkinsHashFunction()
-
-
Method Details
-
hashword
-
hashword2
-
hashlittle
-
hashlittle2
-
hash
- Specified by:
hashin interfaceHashFunction
-
hash
- Specified by:
hashin interfaceHashFunction
-
hash
public long hash(byte[] key, int numBuckets) - Specified by:
hashin interfaceHashFunction
-
hash
public long hash(long key, int numBuckets) - Specified by:
hashin interfaceHashFunction
-