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 Details

  • Constructor Details

    • MurmurHash64

      public MurmurHash64()
  • Method Details

    • 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 array
      seed - The initial seed value
      length - 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 class HashFunction
      Parameters:
      br - the data to be hashed
      Returns:
      the hash of the bytes referenced by bytes.offset and length bytes.length
    • toString

      public String toString()
      Overrides:
      toString in class Object