Package org.apache.lucene.codecs.bloom
Class MurmurHash64
- java.lang.Object
-
- org.apache.lucene.codecs.bloom.HashFunction
-
- org.apache.lucene.codecs.bloom.MurmurHash64
-
public class MurmurHash64 extends HashFunction
This is a very fast, non-cryptographic hash suitable for general hash-based lookup. See http://murmurhash.googlepages.com/ for more details.The code from Apache Commons was adapted in the form here to work with BytesRefs with offsets and lengths rather than raw byte arrays.
-
-
Field Summary
Fields Modifier and Type Field Description static HashFunction
INSTANCE
-
Constructor Summary
Constructors Constructor Description MurmurHash64()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
hash(BytesRef br)
Hashes the contents of the referenced bytesstatic long
hash64(byte[] data, int seed, int offset, int length)
Generates a 64-bit hash from byte array of the given length and seed.String
toString()
-
-
-
Field Detail
-
INSTANCE
public static final HashFunction INSTANCE
-
-
Method Detail
-
hash64
public static long hash64(byte[] data, int seed, int offset, int length)
Generates a 64-bit hash from byte array of the given length and seed.- Parameters:
data
- The input byte arrayseed
- The initial seed valuelength
- The length of the array- Returns:
- The 64-bit hash of the given array
-
hash
public final long hash(BytesRef br)
Description copied from class:HashFunction
Hashes the contents of the referenced bytes- Specified by:
hash
in classHashFunction
- Parameters:
br
- the data to be hashed- Returns:
- the hash of the bytes referenced by bytes.offset and length bytes.length
-
-