Skip to content

API should be better aligned with NonCryptographicHashAlgorithm #9

@maettu-this

Description

@maettu-this

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions