force-net / Crc32.NET

Fast version of Crc32 algorithm for .NET
MIT License
199 stars 52 forks source link

How to calculate CRC32A (ITU I.363.5) checksum? #17

Open katatunix opened 5 years ago

katatunix commented 5 years ago

Hi,

How to calculate CRC32A (ITU I.363.5) checksum by using this library?

force-net commented 5 years ago

It's impossible with this library. There are a lot of CRC algorithms and library implements two most popular. I do not see anything special with this algorithm to implement it here.

katatunix commented 5 years ago

Well, that because I'm porting the PHP hash_file function to C# https://www.php.net/manual/en/function.hash-file.php

I have verified that the output of the "crc32" is the ITU I.363.5 algorithm (a.k.a. AAL5 CRC - popularised by BZIP2 but also used in ATM transmissions - the algorithm is the same as that in POSIX 1003.2-1992 in Cksum but that stuffs the size into the CRC at the end for extra measure).

force-net commented 5 years ago

CRC32A used in BZip2, it has same polynom, but without bit reversing. Current implementation is optimized for calculation with reversed bits, so, every part of code should be rewrited for CRC32A (in most parts I need just switch arrows from >> to << but there are more complex parts : ). As I say, CRC32A are not popular, so, I do not plan to implement it (it can be, but in distant future...)