Class Crc32
Calculates CRC32 checksums.
Inheritance
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class Crc32
Constructors
Crc32()
Initializes a new instance of the Crc32 class using the CRC32 polynomial.
Declaration
public Crc32()
Crc32(Int64)
Initializes a new instance of the Crc32 class using the specified polynomial.
Declaration
public Crc32(long polynomial)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | polynomial | The polynomial. |
Crc32(Int64, Boolean)
Initializes a new instance of the Crc32 class using the specified polynomial.
Declaration
public Crc32(long polynomial, bool reverseBits)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | polynomial | The polynomial. |
System.Boolean | reverseBits | Whether to reverse the bits. |
Properties
Crc32cPolynomial
Gets the CRC32c polynomial.
Declaration
public static long Crc32cPolynomial { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Crc32dPolynomial
Gets the CRC32d polynomial.
Declaration
public static long Crc32dPolynomial { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Crc32Polynomial
Gets the CRC32 polynomial.
Declaration
public static long Crc32Polynomial { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
FinalXorValue
Gets or sets the value used to XOR the final result.
Declaration
public long FinalXorValue { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
InitialValue
Gets or sets the initial value.
Declaration
public long InitialValue { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Polynomial
Gets the polynomial.
Declaration
public long Polynomial { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
ReverseBits
Gets a value indicating whether to reverse the bits.
Declaration
public bool ReverseBits { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Compute(Byte[])
Computes the 32-bit CRC for an array of bytes.
Declaration
public long Compute(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | The bytes. |
Returns
Type | Description |
---|---|
System.Int64 |
Compute(Byte[], Int32)
Computes the 32-bit CRC for an array of bytes.
Declaration
public long Compute(byte[] bytes, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | The bytes. |
System.Int32 | offset | The offset. |
Returns
Type | Description |
---|---|
System.Int64 |
Compute(Byte[], Int32, Int32)
Computes the 32-bit CRC for an array of bytes.
Declaration
public long Compute(byte[] bytes, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | The bytes. |
System.Int32 | offset | The offset. |
System.Int32 | length | The length. |
Returns
Type | Description |
---|---|
System.Int64 |
ComputeHex(Byte[])
Computes the 32-bit CRC hex string for an array of bytes.
Declaration
public string ComputeHex(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | The bytes. |
Returns
Type | Description |
---|---|
System.String |
ComputeHex(Byte[], Int32)
Computes the 32-bit CRC hex string for an array of bytes.
Declaration
public string ComputeHex(byte[] bytes, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | The bytes. |
System.Int32 | offset | The offset. |
Returns
Type | Description |
---|---|
System.String |
ComputeHex(Byte[], Int32, Int32)
Computes the 32-bit CRC hex string for an array of bytes.
Declaration
public string ComputeHex(byte[] bytes, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | The bytes. |
System.Int32 | offset | The offset. |
System.Int32 | length | The length. |
Returns
Type | Description |
---|---|
System.String |