Package org.apache.commons.codec.digest
Class XXHash32
java.lang.Object
org.apache.commons.codec.digest.XXHash32
- All Implemented Interfaces:
Checksum
Implementation of the xxHash32 hash algorithm.
Copied from Commons Compress 1.14 https://gitbox.apache.org/repos/asf?p=commons-compress.git;a=blob;f=src/main/java/org/apache/commons/compress/compressors/lz4/XXHash32.java;h=a406ffc197449be594d46f0d2712b2d4786a1e68;hb=HEAD
NotThreadSafe
- Since:
- 1.11
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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 -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
getInt
(byte[] buffer, int idx) Gets the little-endian int from 4 bytes starting at the specified index.long
getValue()
private void
private void
process
(byte[] b, int offset) void
reset()
void
update
(byte[] b, int off, int len) void
update
(int b)
-
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 stateUpdatedSet 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() -
update
public void update(int b) -
update
public void update(byte[] b, int off, int len) -
getValue
public long getValue() -
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 dataidx
- The index- Returns:
- The little-endian int
-
initializeState
private void initializeState() -
process
private void process(byte[] b, int offset)
-