public final class MurmurHash2 extends HashFunction
The C version of MurmurHash 2.0 found at that site was ported to Java by Andrzej Bialecki (ab at getopt org).
The code from getopt.org was adapted by Mark Harwood in the form here as one of a pluggable choice of hashing functions as the core function had to be adapted to work with BytesRefs with offsets and lengths rather than raw byte arrays.
Modifier and Type | Field and Description |
---|---|
static MurmurHash2 |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
static int |
hash(byte[] data,
int seed,
int offset,
int len) |
int |
hash(BytesRef br)
Hashes the contents of the referenced bytes
|
static int |
hash32(byte[] data,
int offset,
int len)
Generates 32 bit hash from byte array with default seed value.
|
public static final MurmurHash2 INSTANCE
public static int hash(byte[] data, int seed, int offset, int len)
public static final int hash32(byte[] data, int offset, int len)
data
- byte array to hashoffset
- the start position in the array to hashlen
- length of the array elements to hashpublic final int hash(BytesRef br)
HashFunction
hash
in class HashFunction
br
- the data to be hashedCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.