Class Murmur3


  • public class Murmur3
    extends Object
    This class was taken from Hive org.apache.hive.common.util; https://github.com/apache/hive/blob/master/storage-api/src/java/org/apache/hive/common/util/Murmur3.java Commit: dffa3a16588bc8e95b9d0ab5af295a74e06ef702 Murmur3 is successor to Murmur2 fast non-crytographic hash algorithms. Murmur3 32 and 128 bit variants. 32-bit Java port of https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp#94 128-bit Java port of https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp#255 This is a public domain code with no copyrights. From homepage of MurmurHash (https://code.google.com/p/smhasher/), "All MurmurHash versions are public domain software, and the author disclaims all copyright to their code."
    • Constructor Summary

      Constructors 
      Constructor Description
      Murmur3()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long[] hash128​(byte[] data)
      Murmur3 128-bit variant.
      static long[] hash128​(byte[] data, int offset, int length, int seed)
      Murmur3 128-bit variant.
      static int hash32​(byte[] data)
      Murmur3 32-bit variant.
      static int hash32​(byte[] data, int length)
      Murmur3 32-bit variant.
      static int hash32​(byte[] data, int length, int seed)
      Murmur3 32-bit variant.
      static int hash32​(byte[] data, int offset, int length, int seed)
      Murmur3 32-bit variant.
      static int hash32​(long l0)  
      static int hash32​(long l0, int seed)
      Murmur3 32-bit variant.
      static int hash32​(long l0, long l1)  
      static int hash32​(long l0, long l1, int seed)
      Murmur3 32-bit variant.
      static long hash64​(byte[] data)
      Murmur3 64-bit variant.
      static long hash64​(byte[] data, int offset, int length)  
      static long hash64​(byte[] data, int offset, int length, int seed)
      Murmur3 64-bit variant.
      static long hash64​(int data)  
      static long hash64​(long data)  
      static long hash64​(short data)  
    • Constructor Detail

      • Murmur3

        public Murmur3()
    • Method Detail

      • hash32

        public static int hash32​(long l0,
                                 long l1)
      • hash32

        public static int hash32​(long l0)
      • hash32

        public static int hash32​(long l0,
                                 int seed)
        Murmur3 32-bit variant.
      • hash32

        public static int hash32​(long l0,
                                 long l1,
                                 int seed)
        Murmur3 32-bit variant.
      • hash32

        public static int hash32​(byte[] data)
        Murmur3 32-bit variant.
        Parameters:
        data - - input byte array
        Returns:
        - hashcode
      • hash32

        public static int hash32​(byte[] data,
                                 int length)
        Murmur3 32-bit variant.
        Parameters:
        data - - input byte array
        length - - length of array
        Returns:
        - hashcode
      • hash32

        public static int hash32​(byte[] data,
                                 int length,
                                 int seed)
        Murmur3 32-bit variant.
        Parameters:
        data - - input byte array
        length - - length of array
        seed - - seed. (default 0)
        Returns:
        - hashcode
      • hash32

        public static int hash32​(byte[] data,
                                 int offset,
                                 int length,
                                 int seed)
        Murmur3 32-bit variant.
        Parameters:
        data - - input byte array
        offset - - offset of data
        length - - length of array
        seed - - seed. (default 0)
        Returns:
        - hashcode
      • hash64

        public static long hash64​(byte[] data)
        Murmur3 64-bit variant. This is essentially MSB 8 bytes of Murmur3 128-bit variant.
        Parameters:
        data - - input byte array
        Returns:
        - hashcode
      • hash64

        public static long hash64​(long data)
      • hash64

        public static long hash64​(int data)
      • hash64

        public static long hash64​(short data)
      • hash64

        public static long hash64​(byte[] data,
                                  int offset,
                                  int length)
      • hash64

        public static long hash64​(byte[] data,
                                  int offset,
                                  int length,
                                  int seed)
        Murmur3 64-bit variant. This is essentially MSB 8 bytes of Murmur3 128-bit variant.
        Parameters:
        data - - input byte array
        length - - length of array
        seed - - seed. (default is 0)
        Returns:
        - hashcode
      • hash128

        public static long[] hash128​(byte[] data)
        Murmur3 128-bit variant.
        Parameters:
        data - - input byte array
        Returns:
        - hashcode (2 longs)
      • hash128

        public static long[] hash128​(byte[] data,
                                     int offset,
                                     int length,
                                     int seed)
        Murmur3 128-bit variant.
        Parameters:
        data - - input byte array
        offset - - the first element of array
        length - - length of array
        seed - - seed. (default is 0)
        Returns:
        - hashcode (2 longs)