Table of Contents

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

public class Crc32Algorithm : HashAlgorithm, ICryptoTransform, IDisposable
Inheritance
Crc32Algorithm
Implements
Inherited Members

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

initial uint

Initial 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.

input byte[]

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

initial uint

Initial 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.

input byte[]

Input buffer with data to be checksummed.

offset int

Offset of the input data within the buffer.

length int

Length 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

input byte[]

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

input byte[]

Input buffer with data to be checksummed.

offset int

Offset of the input data within the buffer.

length int

Length 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

input byte[]
offset int
length int

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()