Package com.scurrilous.circe.crc
Class AbstractIntCrc
- java.lang.Object
-
- com.scurrilous.circe.impl.AbstractIncrementalIntHash
-
- com.scurrilous.circe.crc.AbstractIntCrc
-
- All Implemented Interfaces:
Hash
,IncrementalIntHash
,StatelessHash
,StatelessIntHash
- Direct Known Subclasses:
NormalByteCrc
,NormalIntCrc
,ReflectedIntCrc
abstract class AbstractIntCrc extends AbstractIncrementalIntHash
Base implementation of int-width CRC functions.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
bitWidth
-
Constructor Summary
Constructors Constructor Description AbstractIntCrc(java.lang.String algorithm, int bitWidth, int initial, int xorOut)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.String
algorithm()
Returns the canonical name of this hash algorithm.protected int
initial()
The initial state of the hash function, which is the same as the output value for an empty input sequence.int
length()
Returns the length in bytes of the output of this hash function.protected int
reflect(int value)
protected abstract int
resumeRaw(int crc, byte[] input, int index, int length)
protected int
resumeUnchecked(int current, byte[] input, int index, int length)
Evaluates this hash function as if the given range of the given input array were appended to the previously hashed input.-
Methods inherited from class com.scurrilous.circe.impl.AbstractIncrementalIntHash
calculate, calculate, calculate, calculate, createStateful, resume, resume, resume, resume, supportsUnsafe
-
-
-
-
Method Detail
-
algorithm
public java.lang.String algorithm()
Description copied from interface:Hash
Returns the canonical name of this hash algorithm.- Returns:
- the name of this hash algorithm
-
length
public int length()
Description copied from interface:Hash
Returns the length in bytes of the output of this hash function.- Returns:
- the hash length in bytes
-
initial
protected int initial()
Description copied from class:AbstractIncrementalIntHash
The initial state of the hash function, which is the same as the output value for an empty input sequence.- Specified by:
initial
in classAbstractIncrementalIntHash
- Returns:
- the initial hash state/output
-
resumeUnchecked
protected int resumeUnchecked(int current, byte[] input, int index, int length)
Description copied from class:AbstractIncrementalIntHash
Evaluates this hash function as if the given range of the given input array were appended to the previously hashed input. The index and length parameters have already been validated.- Specified by:
resumeUnchecked
in classAbstractIncrementalIntHash
- Parameters:
current
- the hash output for input hashed so farinput
- the input arrayindex
- the starting index of the first input bytelength
- the length of the input range- Returns:
- the output of the hash function for the concatenated input
-
resumeRaw
protected abstract int resumeRaw(int crc, byte[] input, int index, int length)
-
reflect
protected final int reflect(int value)
-
-