com.temesoft.google.pr
Class JenkinsHash

java.lang.Object
  extended bycom.temesoft.google.pr.JenkinsHash

public class JenkinsHash
extends java.lang.Object

This is a Bob Jenkins hashing algorithm implementation
These are functions for producing 32-bit hashes for hash table lookup. hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() are externally useful functions. Routines to test the hash are included if SELF_TEST is defined. You can use this free for any purpose. It's in the public domain. It has no warranty.


Field Summary
(package private)  long a
           
(package private)  long b
           
(package private)  long c
           
 
Constructor Summary
JenkinsHash()
           
 
Method Summary
 long hash(byte[] buffer)
          See hash(byte[] buffer, long initialValue)
 long hash(byte[] buffer, long initialValue)
          Hash a variable-length key into a 32-bit value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a

long a

b

long b

c

long c
Constructor Detail

JenkinsHash

public JenkinsHash()
Method Detail

hash

public long hash(byte[] buffer,
                 long initialValue)
Hash a variable-length key into a 32-bit value. Every bit of the key affects every bit of the return value. Every 1-bit and 2-bit delta achieves avalanche. The best hash table sizes are powers of 2.

Parameters:
buffer - Byte array that we are hashing on.
initialValue - Initial value of the hash if we are continuing from a previous run. 0 if none.
Returns:
Hash value for the buffer.

hash

public long hash(byte[] buffer)
See hash(byte[] buffer, long initialValue)

Parameters:
buffer - Byte array that we are hashing on.
Returns:
Hash value for the buffer.