We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is more of a question rather than an issue.
I have one line code written with v1 API:
let checksum = crc32::update(my_u32, &crc32::IEEE_TABLE, mybytes).to_be_bytes();
I tried to translate to V3 API:
let CRC_32_IEEE: Crc<u32> = Crc::<u32>::new(&CRC_32_ISO_HDLC); let mut digest = CRC_32_IEEE.digest_with_initial(my_u32); digest.update(mybytes); let checksum = digest.finalize();
But the result has changed.
Any ideas? Thanks
The text was updated successfully, but these errors were encountered:
I'm guessing my_u32 is the result of a previous crc computation. Is it possible to keep it as a Digest (like in #73) and then update it?
my_u32
Digest
If you must start with a raw digest value, then you can undo the finalization on my_u32 to compute the appropriate initial value:
initial
let initial = (my_u32 ^ CRC.algorithm.xorout).reverse_bits(); let mut digest = CRC.digest_with_initial(initial); digest.update(mybytes); let checksum = digest.finalize();
That should result in the same checksum. But the first approach is recommended for obvious reasons.
Also, you probably want to initialize Crc as a const so that table generation only happens at compile time:
Crc
const CRC_32_IEEE: Crc<u32> = Crc::<u32>::new(&CRC_32_ISO_HDLC);
Sorry, something went wrong.
@akhilles your code works, thanks!
No branches or pull requests
This is more of a question rather than an issue.
I have one line code written with v1 API:
I tried to translate to V3 API:
But the result has changed.
Any ideas? Thanks
The text was updated successfully, but these errors were encountered: