mirror of
https://github.com/SabreTools/SabreTools.Hashing.git
synced 2026-11-17 09:50:31 +00:00
Add CRC-1 (parity bit)
This commit is contained in:
@@ -21,6 +21,9 @@ namespace SabreTools.Hashing.Test
|
||||
{HashType.BLAKE3, "d4bd7ca6f1ebea9580d9381106b248eb5b6069170d0bfd00b17d659fcd10dcdc"},
|
||||
#endif
|
||||
|
||||
{HashType.CRC1_ZERO, "0"},
|
||||
{HashType.CRC1_ONE, "1"},
|
||||
|
||||
{HashType.CRC3_GSM, "4"},
|
||||
{HashType.CRC3_ROHC, "3"},
|
||||
|
||||
|
||||
@@ -3,6 +3,38 @@ namespace SabreTools.Hashing.Crc
|
||||
/// <see href="https://reveng.sourceforge.io/crc-catalogue/all.htm#crc.legend"/>
|
||||
public static class StandardDefinitions
|
||||
{
|
||||
#region CRC-1
|
||||
|
||||
/// <summary>
|
||||
/// CRC-1/ZERO [Parity bit with 0 start]
|
||||
/// </summary>
|
||||
public static readonly CrcDefinition CRC1_ZERO = new()
|
||||
{
|
||||
Name = "CRC-1/ZERO",
|
||||
Width = 1,
|
||||
Poly = 0x1,
|
||||
Init = 0x0,
|
||||
ReflectIn = false,
|
||||
ReflectOut = false,
|
||||
XorOut = 0x0,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// CRC-1/ONE [Parity bit with 1 start]
|
||||
/// </summary>
|
||||
public static readonly CrcDefinition CRC1_ONE = new()
|
||||
{
|
||||
Name = "CRC-1/ONE",
|
||||
Width = 1,
|
||||
Poly = 0x1,
|
||||
Init = 0x1,
|
||||
ReflectIn = false,
|
||||
ReflectOut = false,
|
||||
XorOut = 0x0,
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region CRC-3
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,6 +17,20 @@ namespace SabreTools.Hashing
|
||||
BLAKE3,
|
||||
#endif
|
||||
|
||||
#region CRC-1
|
||||
|
||||
/// <summary>
|
||||
/// CRC 1-bit checksum (CRC-1/ZERO [Parity bit with 0 start])
|
||||
/// </summary>
|
||||
CRC1_ZERO,
|
||||
|
||||
/// <summary>
|
||||
/// CRC 1-bit checksum (CRC-1/ONE [Parity bit with 1 start])
|
||||
/// </summary>
|
||||
CRC1_ONE,
|
||||
|
||||
#endregion
|
||||
|
||||
#region CRC-3
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -119,6 +119,9 @@ namespace SabreTools.Hashing
|
||||
HashType.BLAKE3 => new Blake3HashAlgorithm(),
|
||||
#endif
|
||||
|
||||
HashType.CRC1_ZERO => new CrcRunner(StandardDefinitions.CRC1_ZERO),
|
||||
HashType.CRC1_ONE => new CrcRunner(StandardDefinitions.CRC1_ONE),
|
||||
|
||||
HashType.CRC3_GSM => new CrcRunner(StandardDefinitions.CRC3_GSM),
|
||||
HashType.CRC3_ROHC => new CrcRunner(StandardDefinitions.CRC3_ROHC),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user