-
Notifications
You must be signed in to change notification settings - Fork 4
Support custom crc parameters #11
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
base: main
Are you sure you want to change the base?
Conversation
Enables anyone to BYOP (bring your own parameters). See: awesomized#5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for custom CRC parameters in the library and its C-compatible shared library. Key changes include:
- Adding new functions (new_with_params, checksum_with_params, checksum_file_with_params) in Rust to support custom CRC parameters.
- Extending FFI bindings in Rust and updating the C header (libcrc_fast.h) to expose the new API.
- Adding test coverage for the new functionality.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/lib.rs | New functions for custom CRC parameters added, along with corresponding tests. |
src/ffi.rs | FFI functions added to support the new custom parameter API. |
libcrc_fast.h | Updated header file exposing the new API for custom parameters. |
Comments suppressed due to low confidence (1)
src/lib.rs:618
- The variable 'digest' is declared but never used in this test. Consider removing it to avoid confusion.
let mut digest = Digest::new(config.get_algorithm());
- Crc32Custom and Crc64Custom CrcAlgorithms - checksum_combine_with_custom_params() function - get_custom_params() function - test coverage for the above
Enables easier integration for consumers who would like to use custom CRC parameters, such as polynomials.
- Adds the Crc32Custom and Crc64Custom CrcFastAlgorithms - Adds the crc_fast_checksum_combine_with_custom_params() function - Adds the crc_fast_get_custom_params() function
Replaces get_custom_params() with CrcParams::new(). awesomized#11 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for adding these changes!
The Problem
While the list of hardcoded supported CRC variants is comprehensive, covering all the known CRC-32 and CRC-64 variants, it may be useful to support arbitrary custom parameters for future or unknown variants.
The Solution
Add support for custom CRC parameters.
Changes
Planned version bump
MINOR
Links