@PublicationReference(author="Derek Young",title="MurmurHash 2 Java port",type=WebPage,year=2009,url="http://dmy999.com/article/50/murmurhash-2-java-port") @PublicationReference(author="Wikipedia",title="MurmurHash",type=WebPage,year=2011,url="http://en.wikipedia.org/wiki/MurmurHash") public class Murmur32Hash extends AbstractHashFunction
| Modifier and Type | Field and Description |
|---|---|
protected static byte[] |
DEFAULT_SEED
Default seed: ( 0, 0, 0, 0).
|
static int |
LENGTH
Length of the hash function is 32-bits or 4 bytes, 4.
|
| Constructor and Description |
|---|
Murmur32Hash()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
Murmur32Hash |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
evaluateInto(byte[] input,
byte[] output,
byte[] seed)
Evaluates the input into the given output
|
byte[] |
getDefaultSeed()
Gets the default seed for the hash function
|
static int |
hash(byte[] data,
int seed)
Static hash method that implements the MurmurHash2 32-bit (4-byte)
hash function
|
int |
length()
Returns the number of bytes in the output hash code.
|
evaluate, evaluate, evaluateIntopublic static final int LENGTH
protected static final byte[] DEFAULT_SEED
public Murmur32Hash clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface CloneableSerializableclone in class AbstractHashFunctionpublic void evaluateInto(byte[] input,
byte[] output,
byte[] seed)
HashFunctioninput - Input to compute the hash-function value ofoutput - Output to put the hash-function intoseed - Seed to offset the hash code.public int length()
HashFunctionpublic byte[] getDefaultSeed()
HashFunctionpublic static int hash(byte[] data,
int seed)
data - Input data to hashseed - Seed offset to use