Hi Ben,
CrcAlgorithm already is quite close to NonCryptographicHashAlgorithm, the base for e.g. Crc32 (https://learn.microsoft.com/en-us/dotnet/api/system.io.hashing.crc32), but there are subtle differencies:
Width rather than HashLengthInBytes
- No support for
Append(Stream)
Clear() rather than Reset()
- No
GetHashAndReset()
- ...
Aligning the API would enable deriving from NonCryptographicHashAlgorithm for .NET 6+.
Also note the remark "this stable output is the byte sequence { 0x1C, 0xDF, 0x44, 0x21 }, the Little Endian representation of 0x2144DF1C" which relates to your "TODO" (https://github.com/invertedtomato/crc/blob/master/Library/CrcAlgorithm.cs#L11). I think this "TODO" can be completed by equally documenting the output. A user can still reverse/rearrange the resulting CRC as needed.
Best regards,
Matthias
Hi Ben,
CrcAlgorithmalready is quite close toNonCryptographicHashAlgorithm, the base for e.g.Crc32(https://learn.microsoft.com/en-us/dotnet/api/system.io.hashing.crc32), but there are subtle differencies:Widthrather thanHashLengthInBytesAppend(Stream)Clear()rather thanReset()GetHashAndReset()Aligning the API would enable deriving from
NonCryptographicHashAlgorithmfor .NET 6+.Also note the remark "this stable output is the byte sequence { 0x1C, 0xDF, 0x44, 0x21 }, the Little Endian representation of 0x2144DF1C" which relates to your "TODO" (https://github.com/invertedtomato/crc/blob/master/Library/CrcAlgorithm.cs#L11). I think this "TODO" can be completed by equally documenting the output. A user can still reverse/rearrange the resulting CRC as needed.
Best regards,
Matthias