Class CyclicRedundancyCheck
- Namespace
- Cuemon.Security
- Assembly
- Cuemon.Core.dll
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(UInt64, UInt64, UInt64, Action<CyclicRedundancyCheckOptions>)
Initializes a new instance of the CyclicRedundancyCheck class.
protected CyclicRedundancyCheck(ulong polynomial, ulong initialValue, ulong finalXor, Action<CyclicRedundancyCheckOptions> setup)
Parameters
polynomial
UInt64This is a binary value that should be specified as a hexadecimal number.
initialValue
UInt64This parameter specifies the initial value of the register when the algorithm starts.
finalXor
UInt64This is an W-bit value that should be specified as a hexadecimal number.
setup
Action<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
- UInt64
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
- UInt64
The CRC initial value of the register.
LookupTable
Gets the lookup table containing the pre-computed polynomial values.
protected ulong[] LookupTable { get; }
Property Value
- UInt64[]
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
index
ByteThe index of the array of polynomial values ranging from 0 to 255.
Returns
- UInt64
The initial value for the specified
index
.
PolynomialSlotCalculator(ref UInt64, UInt64)
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)