CyclicRedundancyCheck64 Class
Definition
- Assemblies
- Cuemon.Core.dll
Provides a CRC-64 implementation of the CRC (Cyclic Redundancy Check) checksum algorithm for 64-bit hash values. This class cannot be inherited.
public sealed class CyclicRedundancyCheck64 : CyclicRedundancyCheck, IHash, IConfigurable<CyclicRedundancyCheckOptions>
- Inheritance
-
CyclicRedundancyCheck64
- Implements
- Inherited Members
Examples
The following example demonstrates how to compute a 64-bit Cyclic Redundancy Check (CRC) checksum using the CyclicRedundancyCheck64 class.
using System;
using System.Text;
using Cuemon.Security;
namespace MyApp.Examples;
public class CyclicRedundancyCheck64Example
{
public void Demonstrate()
{
// Create CRC-64 instance with default ECMA-182 polynomial
var crc64 = new CyclicRedundancyCheck64();
// Compute checksum from ASCII input
byte[] data = Encoding.ASCII.GetBytes("123456789");
HashResult result = crc64.ComputeHash(data);
// Display the checksum in hexadecimal
string hex = result.ToHexadecimalString();
Console.WriteLine(hex); // 6c40df5f0b497347
// Create CRC-64 with custom polynomial
var customCrc = new CyclicRedundancyCheck64(
polynomial: 0x42F0E1EBA9EA3693,
initialValue: 0xFFFFFFFFFFFFFFFF,
finalXor: 0xFFFFFFFFFFFFFFFF);
HashResult customResult = customCrc.ComputeHash(data);
Console.WriteLine(customResult.ToHexadecimalString());
}
}
Constructors
| Name | Description |
|---|---|
| CyclicRedundancyCheck64(ulong, ulong, ulong, Action<CyclicRedundancyCheckOptions>) | Initializes a new instance of the CyclicRedundancyCheck64 class. |
Methods
| Name | Description |
|---|---|
| ComputeHash(byte[]) | Computes the hash value for the specified byte array. |
| PolynomialIndexInitializer(byte) | Returns the initial value for the specified |
| PolynomialSlotCalculator(ref ulong, ulong) | Computes the polynomial |