Open ghost opened 3 years ago
@0-wiz-0 CRC_32_BZIP2
is a different algorithm from CRC_32_IEEE
, try CRC_32_ISO_HDLC
instead. Other than that your diff is correct, and should work. One performance nitpick: use const crc: Crc<u32> = Crc::<u32>::new(&CRC_32_BZIP2);
instead to generate the CRC table at compile-time instead of runtime.
It's unfortunate that these CRC polynomials have multiple names (https://reveng.sourceforge.io/crc-catalogue/all.htm is a pretty good reference).
Thanks, @akhilles , that worked!
I also have a question about this. We were using:
crc::crc64::checksum_ecma(&buf[..])
It seems like this should be replace by:
Crc::<u64>::new(&crc::CRC_64_ECMA_182).checksum(&buf[..])
But this is calculating a different checksum value. Is there something equivalent to the old crc::crc64::checksum_ecma()
?
I also have a question about this. We were using:
crc::crc64::checksum_ecma(&buf[..])
It seems like this should be replace by:
Crc::<u64>::new(&crc::CRC_64_ECMA_182).checksum()
But this is calculating a different checksum value. Is there something equivalent to the old
crc::crc64::checksum_ecma()
?
Could you try crc::CRC_64_XZ
? According to https://reveng.sourceforge.io/crc-catalogue/all.htm, it's an algorithm commonly misidentified as ECMA.
Aha, yep, that appears to be it. Thanks @akhilles !
I upgraded from v1.8 to v2 and it was pretty straightforward and painless. I used the reference that was in the documentation (this link: https://reveng.sourceforge.io/crc-catalogue/all.htm) to figure out what constant I needed (for me this was from IEEE
to CRC_32_ISO_HDLC
). It took me about 3 minutes to upgrade. The tip about generating the CRC table at compile-time was also very handy: const crc: Crc<u32> = Crc::<u32>::new(&CRC_32_BZIP2);
I tried this in my code:
but then I get different output for my test files, so this is wrong. What did I do wrong?