public final class MurmurHash3v2 extends Object
The MurmurHash3 is a fast, non-cryptographic, 128-bit hash function that has excellent avalanche and 2-way bit independence properties.
Austin Appleby's C++ MurmurHash3_x64_128(...), final revision 150, which is in the Public Domain, was the inspiration for this implementation in Java.
This implementation of the MurmurHash3 allows hashing of a block of Memory defined by an offset and length. The calling API also allows the user to supply the small output array of two longs, so that the entire hash function is static and free of object allocations.
This implementation produces exactly the same hash result as the
MurmurHash3.hash(long[], long)
function given compatible inputs.
Constructor and Description |
---|
MurmurHash3v2() |
Modifier and Type | Method and Description |
---|---|
static long[] |
hash(byte[] in,
long seed)
Returns a 128-bit hash of the input.
|
static long[] |
hash(char[] in,
long seed)
Returns a 128-bit hash of the input.
|
static long[] |
hash(double in,
long seed,
long[] hashOut)
Returns a 128-bit hash of the input.
|
static long[] |
hash(int[] in,
long seed)
Returns a 128-bit hash of the input.
|
static long[] |
hash(long[] in,
long seed)
Returns a 128-bit hash of the input.
|
static long[] |
hash(long in,
long seed,
long[] hashOut)
Returns a 128-bit hash of the input.
|
static long[] |
hash(org.apache.datasketches.memory.Memory mem,
long offsetBytes,
long lengthBytes,
long seed,
long[] hashOut)
Returns a 128-bit hash of the input as a long array of size 2.
|
static long[] |
hash(String in,
long seed,
long[] hashOut)
Returns a 128-bit hash of the input.
|
public static long[] hash(long[] in, long seed)
in
- long arrayseed
- A long valued seed.public static long[] hash(int[] in, long seed)
in
- int arrayseed
- A long valued seed.public static long[] hash(char[] in, long seed)
in
- char arrayseed
- A long valued seed.public static long[] hash(byte[] in, long seed)
in
- byte arrayseed
- A long valued seed.public static long[] hash(long in, long seed, long[] hashOut)
in
- a longseed
- A long valued seed.hashOut
- A long array of size 2public static long[] hash(double in, long seed, long[] hashOut)
in
- a doubleseed
- A long valued seed.hashOut
- A long array of size 2public static long[] hash(String in, long seed, long[] hashOut)
in
- a Stringseed
- A long valued seed.hashOut
- A long array of size 2public static long[] hash(org.apache.datasketches.memory.Memory mem, long offsetBytes, long lengthBytes, long seed, long[] hashOut)
mem
- The input Memory. Must be non-null and non-empty.offsetBytes
- the starting point within Memory.lengthBytes
- the total number of bytes to be hashed.seed
- A long valued seed.hashOut
- the size 2 long array for the resulting 128-bit hashCopyright © 2015–2021 The Apache Software Foundation. All rights reserved.