Package smile.hash

Interface MurmurHash2


public interface MurmurHash2
MurmurHash is a very fast, non-cryptographic hash suitable for general hash-based lookup. The name comes from two basic operations, multiply (MU) and rotate (R), used in its inner loop. See this page for more details.

The older MurmurHash2 yields a 32-bit or 64-bit value.

This class is adapted from Apache Cassandra.

See Also:
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static int
    hash32(ByteBuffer data, int offset, int length, int seed)
    32-bit MurmurHash.
    static long
    hash64(ByteBuffer data, int offset, int length, long seed)
    64-bit MurmurHash.
  • Method Details

    • hash32

      static int hash32(ByteBuffer data, int offset, int length, int seed)
      32-bit MurmurHash.
      Parameters:
      data - the data buffer.
      offset - the start offset of data in the buffer.
      length - the length of data.
      seed - the seed of hash code.
      Returns:
      the hash code.
    • hash64

      static long hash64(ByteBuffer data, int offset, int length, long seed)
      64-bit MurmurHash.
      Parameters:
      data - the data buffer.
      offset - the start offset of data in the buffer.
      length - the length of data.
      seed - the seed of hash code.
      Returns:
      the hash code.