Class ES87BloomFilterPostingsFormat.MurmurHash3
- Enclosing class:
ES87BloomFilterPostingsFormat
MurmurHash is a non-cryptographic hash function suitable for general hash-based lookup. The name comes from two basic operations, multiply (MU) and rotate (R), used in its inner loop. Unlike cryptographic hash functions, it is not specifically designed to be difficult to reverse by an adversary, making it unsuitable for cryptographic purposes.
This contains a Java port of the 32-bit hash function MurmurHash3_x86_32 and the 128-bit hash function
MurmurHash3_x64_128 from Austin Appleby's original c++ code in SMHasher.
This is public domain code with no copyrights. From home page of SMHasher:
"All MurmurHash versions are public domain software, and the author disclaims all copyright to their code."
Original adaption from Apache Hive. That adaption contains a hash64 method that is not part of the original
MurmurHash3 code. It is not recommended to use these methods. They will be removed in a future release. To obtain a
64-bit hash use half of the bits from the hash128x64 methods using the input data converted to bytes.
- Since:
- 1.13
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intA default seed to use for the murmur hash algorithm. -
Method Summary
Modifier and TypeMethodDescriptionstatic longhash64(byte[] data, int offset, int length) Generates 64-bit hash from the byte array with the given offset, length and seed by discarding the second value of the 128-bit hash.
-
Field Details
-
DEFAULT_SEED
public static final int DEFAULT_SEEDA default seed to use for the murmur hash algorithm. Has the value104729.- See Also:
-
-
Method Details
-
hash64
public static long hash64(byte[] data, int offset, int length) Generates 64-bit hash from the byte array with the given offset, length and seed by discarding the second value of the 128-bit hash. This version uses the default seed.- Parameters:
data- The input byte arrayoffset- The first element of arraylength- The length of array- Returns:
- The sum of the two 64-bit hashes that make up the hash128
-