Class ES87BloomFilterPostingsFormat.MurmurHash3

java.lang.Object
org.elasticsearch.index.codec.bloomfilter.ES87BloomFilterPostingsFormat.MurmurHash3
Enclosing class:
ES87BloomFilterPostingsFormat

public static final class ES87BloomFilterPostingsFormat.MurmurHash3 extends Object
Implementation of the MurmurHash3 128-bit hash functions.

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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A default seed to use for the murmur hash algorithm.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_SEED

      public static final int DEFAULT_SEED
      A default seed to use for the murmur hash algorithm. Has the value 104729.
      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 array
      offset - The first element of array
      length - The length of array
      Returns:
      The sum of the two 64-bit hashes that make up the hash128