Table of Contents

Class Crc32

Namespace
System.IO.Hashing
Assembly
nanoFramework.System.IO.Hashing.dll

Provides an implementation of the CRC-32 algorithm, as used in ITU-T V.42 and IEEE 802.3.

public class Crc32
Inheritance
Crc32
Inherited Members
Extension Methods

Remarks

If the platform or target doesn't support Hardware Crc32 computation it will offer a software implementation.

For methods that return byte arrays or that write into spans of bytes, this implementation emits the answer in the Little Endian byte order so that the CRC residue relationship (CRC(message concat CRC(message))) is a fixed value) holds. For CRC-32 this stable output is the byte sequence { 0x1C, 0xDF, 0x44, 0x21 }, the Little Endian representation of 0x2144DF1C.

There are multiple, incompatible, definitions of a 32-bit cyclic redundancy check (CRC) algorithm. When interoperating with another system, ensure that you are using the same definition. The definition used by this implementation is not compatible with the cyclic redundancy check described in ITU-T I.363.5.

Constructors

Crc32()

Initializes a new instance of the Crc32 class.

public Crc32()

Methods

Append(byte)

Appends value to the data already processed for the current hash computation.

public void Append(byte value)

Parameters

value byte

The byte to process.

Append(byte[])

Appends the contents of source to the data already processed for the current hash computation.

public void Append(byte[] source)

Parameters

source byte[]

The data to process.

Append(SpanByte)

Appends the contents of source to the data already processed for the current hash computation.

public void Append(SpanByte source)

Parameters

source SpanByte

The data to process.

GetCurrentHashAsUInt32()

Gets the current computed hash value without modifying accumulated state.

public uint GetCurrentHashAsUInt32()

Returns

uint

The hash value for the data already provided.

HashToUInt32(SpanByte)

Computes the CRC-32 hash of the provided data.

public static uint HashToUInt32(SpanByte source)

Parameters

source SpanByte

The data to hash.

Returns

uint

The computed CRC-32 hash.

Reset()

Resets the hash computation to the initial state.

public void Reset()