Class XXHash32

java.lang.Object
org.apache.commons.codec.digest.XXHash32
All Implemented Interfaces:
Checksum

public class XXHash32 extends Object implements Checksum
Since:
1.11
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
     
    private final byte[]
     
    private final byte[]
     
    private int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private final int
     
    private final int[]
     
    private boolean
    Set to true when the state array has been updated since the last reset.
    private int
     
  • Constructor Summary

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

    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
     
    private void
     
    private void
    process(byte[] b, int offset)
     
    void
     
    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
  • Field Details

    • BUF_SIZE

      private static final int BUF_SIZE
      See Also:
    • ROTATE_BITS

      private static final int ROTATE_BITS
      See Also:
    • PRIME1

      private static final int PRIME1
      See Also:
    • PRIME2

      private static final int PRIME2
      See Also:
    • PRIME3

      private static final int PRIME3
      See Also:
    • PRIME4

      private static final int PRIME4
      See Also:
    • PRIME5

      private static final int PRIME5
      See Also:
    • 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 Details

    • 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 Details

    • reset

      public void reset()
      Specified by:
      reset in interface Checksum
    • update

      public void update(int b)
      Specified by:
      update in interface Checksum
    • update

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

      public long getValue()
      Specified by:
      getValue in interface 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)