Class MurmurHash3

java.lang.Object
io.debezium.util.MurmurHash3

public class MurmurHash3 extends Object
Taken from Infinispan code base. Removed irrelevant and unused parts like Externalizer or 128 bits hashes and format the code to match Debezium checkstyle rules. MurmurHash3 implementation in Java, based on Austin Appleby's original in C Only implementing x64 version, because this should always be faster on 64 bit native processors, even 64 bit being ran with a 32 bit OS; this should also be as fast or faster than the x86 version on some modern 32 bit processors.
Author:
Patrick McFarland
See Also:
  • Field Details

  • Constructor Details

    • MurmurHash3

      private MurmurHash3()
  • Method Details

    • getInstance

      public static MurmurHash3 getInstance()
    • getblock

      static long getblock(byte[] key, int i)
    • bmix

      static void bmix(MurmurHash3.State state)
    • fmix

      static long fmix(long k)
    • MurmurHash3_x64_64

      public static long MurmurHash3_x64_64(byte[] key, int seed)
      Hash a value using the x64 64 bit variant of MurmurHash3
      Parameters:
      key - value to hash
      seed - random value
      Returns:
      64 bit hashed key
    • MurmurHash3_x64_32

      public static int MurmurHash3_x64_32(byte[] key, int seed)
      Hash a value using the x64 32 bit variant of MurmurHash3
      Parameters:
      key - value to hash
      seed - random value
      Returns:
      32 bit hashed key
    • MurmurHash3_x64_64

      public static long MurmurHash3_x64_64(long[] key, int seed)
      Hash a value using the x64 64 bit variant of MurmurHash3
      Parameters:
      key - value to hash
      seed - random value
      Returns:
      64 bit hashed key
    • MurmurHash3_x64_32

      public static int MurmurHash3_x64_32(long[] key, int seed)
      Hash a value using the x64 32 bit variant of MurmurHash3
      Parameters:
      key - value to hash
      seed - random value
      Returns:
      32 bit hashed key
    • hash

      public int hash(byte[] payload)
    • hash

      public static int hash(long[] payload)
      Hashes a byte array efficiently.
      Parameters:
      payload - a byte array to hash
      Returns:
      a hash code for the byte array
    • hash

      public int hash(int hashcode)
    • hash

      public int hash(Object o)
    • hashString

      private int hashString(String s)
    • MurmurHash3_x64_64_String

      private long MurmurHash3_x64_64_String(String s, long seed)
    • addByte

      private void addByte(MurmurHash3.State state, byte b, int len)
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object