-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
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
Add Crc::digest_with_initial #69
Conversation
For reference, the |
Would it be possible to add some test cases with the expected checksums generated by another crc impl? I'm not sure if the way we handle reflection of custom init is considered "correct". |
I'd say the way it is handled now is conceptually correct since the custom init value is treated in the same way as |
A comment would be enough IMO, and then we can merge. |
Thanks for merging! Would it be possible to release a new version including this change on crates.io? |
I'll try to cut a minor release (v2.2.0) by tomorrow. There are some breaking changes that I either need to patch or exclude. |
It may sometimes be useful to compute CRC values with an initial value different from the one specified by the used algorithm.
In this case, users currently have to create a new
Algorithm
for each initial value.This is particularly problematic if the initial values are not statically known, since
Crc::new
takes a static reference to an algorithm (see also #68).With the small change proposed in this PR, an initial value may optionally be supplied when creating a
Digest
.