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 final HashFunction
     
    private static final long
     
    private static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final long
    Hashes the contents of the referenced bytes
    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.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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