Package org.apache.solr.common.util
Class MurmurHash2
- java.lang.Object
-
- org.apache.solr.common.util.MurmurHash2
-
public final class MurmurHash2 extends Object
This is a very fast, non-cryptographic hash suitable for general hash-based lookup. See http://murmurhash.googlepages.com/ for more details.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.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static MurmurHash2
INSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static int
hash(byte[] data, int seed, int offset, int len)
static int
hash32(byte[] data, int offset, int len)
Generates 32 bit hash from byte array with default seed value.String
toString()
-
-
-
Field Detail
-
INSTANCE
public static final MurmurHash2 INSTANCE
-
-
Method Detail
-
hash
public static int hash(byte[] data, int seed, int offset, int len)
-
hash32
public static final int hash32(byte[] data, int offset, int len)
Generates 32 bit hash from byte array with default seed value.- Parameters:
data
- byte array to hashoffset
- the start position in the array to hashlen
- length of the array elements to hash- Returns:
- 32 bit hash of the given array
-
-