Class Murmur3

java.lang.Object
org.apache.orc.util.Murmur3

public class Murmur3 extends Object
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."

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    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, 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Murmur3

      public Murmur3()
  • Method Details

    • 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, int seed)
      Murmur3 32-bit variant.
      Parameters:
      data - - input byte array
      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(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)