Class JenkinsHashFunction

java.lang.Object
com.linkedin.alpini.base.hash.JenkinsHashFunction
All Implemented Interfaces:
HashFunction

public final class JenkinsHashFunction extends Object implements 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 Details

    • JenkinsHashFunction

      public JenkinsHashFunction()
  • Method Details

    • hashword

      public int hashword(IntBuffer k, int initval)
    • hashword2

      public long hashword2(IntBuffer k, long initval)
    • hashlittle

      public int hashlittle(ByteBuffer k, int initval)
    • hashlittle2

      public long hashlittle2(ByteBuffer k, long initval)
    • hash

      public long hash(ByteBuffer buf)
      Specified by:
      hash in interface HashFunction
    • hash

      public long hash(ByteBuffer buf, int off, int len)
      Specified by:
      hash in interface HashFunction
    • hash

      public long hash(byte[] key, int numBuckets)
      Specified by:
      hash in interface HashFunction
    • hash

      public long hash(long key, int numBuckets)
      Specified by:
      hash in interface HashFunction