Class JenkinsHashFunction

  • All Implemented Interfaces:
    HashFunction

    public final class JenkinsHashFunction
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long hash​(byte[] key, int numBuckets)  
      long hash​(long key, int numBuckets)  
      long hash​(java.nio.ByteBuffer buf)  
      long hash​(java.nio.ByteBuffer buf, int off, int len)  
      int hashlittle​(java.nio.ByteBuffer k, int initval)  
      long hashlittle2​(java.nio.ByteBuffer k, long initval)  
      int hashword​(java.nio.IntBuffer k, int initval)  
      long hashword2​(java.nio.IntBuffer k, long initval)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JenkinsHashFunction

        public JenkinsHashFunction()
    • Method Detail

      • hashword

        public int hashword​(java.nio.IntBuffer k,
                            int initval)
      • hashword2

        public long hashword2​(java.nio.IntBuffer k,
                              long initval)
      • hashlittle

        public int hashlittle​(java.nio.ByteBuffer k,
                              int initval)
      • hashlittle2

        public long hashlittle2​(java.nio.ByteBuffer k,
                                long initval)
      • hash

        public long hash​(java.nio.ByteBuffer buf)
        Specified by:
        hash in interface HashFunction
      • hash

        public long hash​(java.nio.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