Package org.apache.commons.codec.digest
Class XXHash32
- java.lang.Object
-
- org.apache.commons.codec.digest.XXHash32
-
- All Implemented Interfaces:
java.util.zip.Checksum
public class XXHash32 extends java.lang.Object implements java.util.zip.ChecksumImplementation of the xxhash32 hash algorithm.Copied from Commons Compress 1.14 https://git-wip-us.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:
- xxHash
-
-
Field Summary
Fields Modifier and Type Field Description private static intBUF_SIZEprivate byte[]bufferprivate byte[]oneByteprivate intposprivate static intPRIME1private static intPRIME2private static intPRIME3private static intPRIME4private static intPRIME5private static intROTATE_BITSprivate intseedprivate int[]stateprivate inttotalLen
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static longfromLittleEndian(byte[] bytes, int off, int length)Reads the given byte array as a little endian long.private static intgetInt(byte[] buffer, int idx)longgetValue()private voidinitializeState()private voidprocess(byte[] b, int offset)voidreset()voidupdate(byte[] b, int off, int len)voidupdate(int b)
-
-
-
Field Detail
-
BUF_SIZE
private static final int BUF_SIZE
- See Also:
- Constant Field Values
-
ROTATE_BITS
private static final int ROTATE_BITS
- See Also:
- Constant Field Values
-
PRIME1
private static final int PRIME1
- See Also:
- Constant Field Values
-
PRIME2
private static final int PRIME2
- See Also:
- Constant Field Values
-
PRIME3
private static final int PRIME3
- See Also:
- Constant Field Values
-
PRIME4
private static final int PRIME4
- See Also:
- Constant Field Values
-
PRIME5
private static final int PRIME5
- See Also:
- Constant Field Values
-
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
-
-
Method Detail
-
reset
public void reset()
- Specified by:
resetin interfacejava.util.zip.Checksum
-
update
public void update(int b)
- Specified by:
updatein interfacejava.util.zip.Checksum
-
update
public void update(byte[] b, int off, int len)- Specified by:
updatein interfacejava.util.zip.Checksum
-
getValue
public long getValue()
- Specified by:
getValuein interfacejava.util.zip.Checksum
-
getInt
private static int getInt(byte[] buffer, int idx)
-
initializeState
private void initializeState()
-
process
private void process(byte[] b, int offset)
-
fromLittleEndian
private static long fromLittleEndian(byte[] bytes, int off, int length)Reads the given byte array as a little endian long.- Parameters:
bytes- the byte array to convertoff- the offset into the array that starts the valuelength- the number of bytes representing the value- Returns:
- the number read
- Throws:
java.lang.IllegalArgumentException- if len is bigger than eight
-
-