Class CyclicRedundancyCheck
Represents the base class from which all implementations of the CRC (Cyclic Redundancy Check) checksum algorithm must derive.
public abstract class CyclicRedundancyCheck : Hash<CyclicRedundancyCheckOptions>, IHash, IConfigurable<CyclicRedundancyCheckOptions>
- Inheritance
-
CyclicRedundancyCheck
- Implements
- Derived
- Inherited Members
Remarks
Help and inspiration was gathered @ http://www.ross.net/crc/download/crc_v3.txt
Constructors
CyclicRedundancyCheck(ulong, ulong, ulong, Action<CyclicRedundancyCheckOptions>)
Initializes a new instance of the CyclicRedundancyCheck class.
protected CyclicRedundancyCheck(ulong polynomial, ulong initialValue, ulong finalXor, Action<CyclicRedundancyCheckOptions> setup)
Parameters
polynomialulongThis is a binary value that should be specified as a hexadecimal number.
initialValueulongThis parameter specifies the initial value of the register when the algorithm starts.
finalXorulongThis is an W-bit value that should be specified as a hexadecimal number.
setupAction<CyclicRedundancyCheckOptions>The CyclicRedundancyCheckOptions which need to be configured.
Properties
FinalXor
Gets the CRC final value that is XORed to the final register value.
public ulong FinalXor { get; }
Property Value
- ulong
The CRC final value that is XORed to the final register value.
InitialValue
Gets the CRC initial value of the register.
public ulong InitialValue { get; }
Property Value
- ulong
The CRC initial value of the register.
LookupTable
Gets the lookup table containing the pre-computed polynomial values.
protected ulong[] LookupTable { get; }
Property Value
- ulong[]
The lookup table containing the pre-computed polynomial values.
Methods
PolynomialIndexInitializer(byte)
Returns the initial value for the specified index of the polynomial LookupTable.
protected abstract ulong PolynomialIndexInitializer(byte index)
Parameters
indexbyteThe index of the array of polynomial values ranging from 0 to 255.
Returns
- ulong
The initial value for the specified
index.
PolynomialSlotCalculator(ref ulong, ulong)
Computes the polynomial checksum value in steps of 8 (0-7) x 256 (0-255) giving a total of 2048 times.
protected abstract void PolynomialSlotCalculator(ref ulong checksum, ulong polynomial)