Class Murmur3F

  • All Implemented Interfaces:
    Checksum128, java.util.zip.Checksum

    public class Murmur3F
    extends java.lang.Object
    implements Checksum128
    Murmur3F (MurmurHash3_x64_128)
    • Constructor Summary

      Constructors 
      Constructor Description
      Murmur3F()  
      Murmur3F​(int seed)  
      Murmur3F​(int seed, boolean unsafe)
      This constructor allows you to require that an unsafe implementation of primitive array operations is used, for added speed on platforms that you know can support it.
    • Method Summary

      Modifier and Type Method Description
      long getValue()  
      java.math.BigInteger getValueBigInteger()
      Positive value.
      byte[] getValueBytesBigEndian()
      Big endian is the default in Java / network byte order.
      byte[] getValueBytesLittleEndian()
      Big endian is used by most machines natively.
      java.lang.String getValueHexString()
      Padded with leading 0s to ensure length of 32.
      long getValueHigh()
      Returns the higher 64 bits of the 128 bit hash.
      void reset()  
      void update​(byte[] b)  
      void update​(byte[] b, int off, int len)  
      void update​(int b)  
      void updateLongBE​(long value)
      Consider updateLongLE(long) for better performance if you do not rely on big endian (BE) byte order.
      void updateLongLE​(long value)
      Special update method to hash long values very efficiently using Java's native little endian (LE) byte order.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.zip.Checksum

        update
    • Constructor Detail

      • Murmur3F

        public Murmur3F​(int seed,
                        boolean unsafe)
        This constructor allows you to require that an unsafe implementation of primitive array operations is used, for added speed on platforms that you know can support it. This allows callers to have an easy way to exclusively opt in or out of unsafe behavior at a class-loader level, rather than forcing an unsafe behavior before the caller gets a chance to intervene. The choice is either/or, not "optional, but fall back if not supported." Callers can instrument for this with exception handling if it is needed. Effectively, setting the unsafe value chooses an implementation.
        Parameters:
        seed - A seed to initialize this hash with, or the input when using it as a function.
        unsafe - Whether to require that the implementation relies on an unsafe calls.
      • Murmur3F

        public Murmur3F()
      • Murmur3F

        public Murmur3F​(int seed)
    • Method Detail

      • update

        public void update​(int b)
        Specified by:
        update in interface java.util.zip.Checksum
      • updateLongLE

        public void updateLongLE​(long value)
        Special update method to hash long values very efficiently using Java's native little endian (LE) byte order. Note, that you cannot mix this with other (previous) hash updates, because it only supports 8-bytes alignment.
        Parameters:
        value - the long to add to the hash register
      • updateLongBE

        public void updateLongBE​(long value)
        Consider updateLongLE(long) for better performance if you do not rely on big endian (BE) byte order.
        Parameters:
        value - the long to add to the hash register
      • update

        public void update​(byte[] b)
        Specified by:
        update in interface java.util.zip.Checksum
      • update

        public void update​(byte[] b,
                           int off,
                           int len)
        Specified by:
        update in interface java.util.zip.Checksum
      • getValue

        public long getValue()
        Specified by:
        getValue in interface java.util.zip.Checksum
      • getValueHigh

        public long getValueHigh()
        Returns the higher 64 bits of the 128 bit hash.
        Specified by:
        getValueHigh in interface Checksum128
        Returns:
        Returns the higher 64 bits of the 128 bit hash.
      • getValueBigInteger

        public java.math.BigInteger getValueBigInteger()
        Positive value.
        Specified by:
        getValueBigInteger in interface Checksum128
        Returns:
        Positive value.
      • getValueHexString

        public java.lang.String getValueHexString()
        Padded with leading 0s to ensure length of 32.
        Specified by:
        getValueHexString in interface Checksum128
        Returns:
        Padded with leading 0s to ensure length of 32.
      • getValueBytesBigEndian

        public byte[] getValueBytesBigEndian()
        Description copied from interface: Checksum128
        Big endian is the default in Java / network byte order.
        Specified by:
        getValueBytesBigEndian in interface Checksum128
        Returns:
        Big Endian bytes
      • getValueBytesLittleEndian

        public byte[] getValueBytesLittleEndian()
        Description copied from interface: Checksum128
        Big endian is used by most machines natively.
        Specified by:
        getValueBytesLittleEndian in interface Checksum128
        Returns:
        Little Endian bytes
      • reset

        public void reset()
        Specified by:
        reset in interface java.util.zip.Checksum