Package com.scurrilous.circe.crc
Class AbstractLongCrc
java.lang.Object
com.scurrilous.circe.impl.AbstractIncrementalLongHash
com.scurrilous.circe.crc.AbstractLongCrc
- All Implemented Interfaces:
Hash,IncrementalLongHash,StatelessHash,StatelessLongHash
- Direct Known Subclasses:
NormalLongCrc,ReflectedLongCrc
Base implementation of long-width CRC functions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the canonical name of this hash algorithm.protected longinitial()The initial state of the hash function, which is the same as the output value for an empty input sequence.intlength()Returns the length in bytes of the output of this hash function.protected final longreflect(long value) protected abstract longresumeRaw(long crc, byte[] input, int index, int length) protected longresumeUnchecked(long 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.AbstractIncrementalLongHash
calculate, calculate, calculate, calculate, createStateful, resume, resume, resume, resume, supportsUnsafe
-
Field Details
-
bitWidth
protected final int bitWidth
-
-
Constructor Details
-
AbstractLongCrc
AbstractLongCrc(String algorithm, int bitWidth, long initial, long xorOut)
-
-
Method Details
-
algorithm
Description copied from interface:HashReturns the canonical name of this hash algorithm.- Returns:
- the name of this hash algorithm
-
length
public int length()Description copied from interface:HashReturns the length in bytes of the output of this hash function.- Returns:
- the hash length in bytes
-
initial
protected long initial()Description copied from class:AbstractIncrementalLongHashThe initial state of the hash function, which is the same as the output value for an empty input sequence.- Specified by:
initialin classAbstractIncrementalLongHash- Returns:
- the initial hash state/output
-
resumeUnchecked
protected long resumeUnchecked(long current, byte[] input, int index, int length) Description copied from class:AbstractIncrementalLongHashEvaluates 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:
resumeUncheckedin classAbstractIncrementalLongHash- 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 long resumeRaw(long crc, byte[] input, int index, int length) -
reflect
protected final long reflect(long value)
-