Class XXHash32

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int BUF_SIZE  
      private byte[] buffer  
      private byte[] oneByte  
      private int pos  
      private static int PRIME1  
      private static int PRIME2  
      private static int PRIME3  
      private static int PRIME4  
      private static int PRIME5  
      private static int ROTATE_BITS  
      private int seed  
      private int[] state  
      private boolean stateUpdated
      Set to true when the state array has been updated since the last reset.
      private int totalLen  
    • Constructor Summary

      Constructors 
      Constructor Description
      XXHash32()
      Creates an XXHash32 instance with a seed of 0.
      XXHash32​(int seed)
      Creates an XXHash32 instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static int getInt​(byte[] buffer, int idx)
      Gets the little-endian int from 4 bytes starting at the specified index.
      long getValue()  
      private void initializeState()  
      private void process​(byte[] b, int offset)  
      void reset()  
      void update​(byte[] b, int off, int len)  
      void update​(int b)  
      • 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, update
    • Field Detail

      • oneByte

        private final byte[] oneByte
      • state

        private final int[] state
      • buffer

        private final byte[] buffer
      • seed

        private final int seed
      • totalLen

        private int totalLen
      • pos

        private int pos
      • stateUpdated

        private boolean stateUpdated
        Set to true when the state array has been updated since the last reset.
    • Constructor Detail

      • XXHash32

        public XXHash32()
        Creates an XXHash32 instance with a seed of 0.
      • XXHash32

        public XXHash32​(int seed)
        Creates an XXHash32 instance.
        Parameters:
        seed - the seed to use
    • Method Detail

      • reset

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

        public void update​(int 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
      • getInt

        private static int getInt​(byte[] buffer,
                                  int idx)
        Gets the little-endian int from 4 bytes starting at the specified index.
        Parameters:
        buffer - The data
        idx - The index
        Returns:
        The little-endian int
      • initializeState

        private void initializeState()
      • process

        private void process​(byte[] b,
                             int offset)