Class Crc32Algorithm
- Namespace
- Vintagestory.API.MathTools
- Assembly
- VintagestoryAPI.dll
Implementation of CRC-32. This class supports several convenient static methods returning the CRC as UInt32. From https://github.com/force-net/Crc32.NET Open in GitHub
public class Crc32Algorithm : HashAlgorithm, ICryptoTransform, IDisposable
- Inheritance
-
Crc32Algorithm
- Implements
- Inherited Members
- Extension Methods
Constructors
Crc32Algorithm()
Initializes a new instance of the Crc32Algorithm class.
public Crc32Algorithm()
Methods
Append(uint, byte[])
Computes CRC-3C from multiple buffers. Call this method multiple times to chain multiple buffers.
public static uint Append(uint initial, byte[] input)
Parameters
initialuintInitial CRC value for the algorithm. It is zero for the first buffer. Subsequent buffers should have their initial value set to CRC value returned by previous call to this method.
inputbyte[]Input buffer containing data to be checksummed.
Returns
- uint
Accumulated CRC-32 of all buffers processed so far.
Append(uint, byte[], int, int)
Computes CRC-32 from multiple buffers. Call this method multiple times to chain multiple buffers.
public static uint Append(uint initial, byte[] input, int offset, int length)
Parameters
initialuintInitial CRC value for the algorithm. It is zero for the first buffer. Subsequent buffers should have their initial value set to CRC value returned by previous call to this method.
inputbyte[]Input buffer with data to be checksummed.
offsetintOffset of the input data within the buffer.
lengthintLength of the input data in the buffer.
Returns
- uint
Accumulated CRC-32 of all buffers processed so far.
Compute(byte[])
Computes CRC-32 from input buffer.
public static uint Compute(byte[] input)
Parameters
inputbyte[]Input buffer containing data to be checksummed.
Returns
- uint
CRC-32 of the buffer.
Compute(byte[], int, int)
Computes CRC-32 from input buffer.
public static uint Compute(byte[] input, int offset, int length)
Parameters
inputbyte[]Input buffer with data to be checksummed.
offsetintOffset of the input data within the buffer.
lengthintLength of the input data in the buffer.
Returns
- uint
CRC-32 of the data in the buffer.
HashCore(byte[], int, int)
Appends CRC-32 from given buffer
protected override void HashCore(byte[] input, int offset, int length)
Parameters
HashFinal()
Computes CRC-32 from HashCore(byte[], int, int)
protected override byte[] HashFinal()
Returns
- byte[]
Initialize()
Resets internal state of the algorithm. Used internally.
public override void Initialize()