Conversation
|
@leiysky I'm considering include MD5, CRC, and perhaps FxHash in
What do you think? How would you define the scope of this crate? ... and perhaps I'm going to create feature flags, one for each hash algorithm (family). |
There was a problem hiding this comment.
🟢 Approval recommended
The MD5 implementation is well-scoped, keeps the published crate dependency-free, and is backed by RFC vectors plus extensive differential integration tests and benchmarks.
Pull request overview
This PR adds first-party MD5 support to the hashcrew crate for interoperability scenarios, while keeping the published crate dependency-free, allocation-free, and no_std compatible.
Changes:
- Introduces a new
hashcrew::md5module with one-shotmd5(&[u8]) -> [u8; 16]and a streamingMd5state whosedigest()is non-consuming and supports continuedupdate()calls. - Adds integration tests and benchmarks that compare
hashcrewMD5 outputs against RustCrypto’smd-5crate (dev-only usage). - Updates public-facing documentation and the changelog to describe MD5 support and its non-cryptographic/security caveats.
File summaries
| File | Description |
|---|---|
| tests-integration/tests/md5.rs | Adds differential integration tests vs RustCrypto across padding, block boundaries, and randomized streaming splits. |
| tests-integration/tests/io.rs | Extends the std::io::Write integration tests to include the new md5::Md5 state. |
| tests-integration/Cargo.toml | Adds RustCrypto md-5 as a workspace dependency for integration test comparisons. |
| README.md | Documents the new md5 module, updates capability tables, and clarifies digest() semantics and MD5 caveats. |
| hashcrew/src/md5/mod.rs | Implements MD5 one-shot and streaming state (including std::io::Write under std) plus RFC vector tests. |
| hashcrew/src/lib.rs | Exposes the new md5 module and updates crate-level docs and capability map. |
| hashcrew/Cargo.toml | Updates the crate description text to match the revised messaging. |
| CHANGELOG.md | Records the new MD5 feature and its integration boundaries in the Unreleased section. |
| Cargo.toml | Adds workspace dependency entry for RustCrypto md-5 (for dev-only crates like tests/benchmarks). |
| Cargo.lock | Locks the new md-5 dependency graph for the workspace. |
| benchmarks/README.md | Documents MD5 benchmark coverage and adds benchmark commands for MD5. |
| benchmarks/Cargo.toml | Adds RustCrypto md-5 to benchmark dependencies for comparison runs. |
| benchmarks/benches/throughput.rs | Adds MD5 throughput benchmarks for hashcrew vs RustCrypto. |
| benchmarks/benches/streaming.rs | Adds MD5 streaming and digest-read benchmarks for hashcrew vs RustCrypto. |
Review details
- Files reviewed: 13/14 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
Add MD5 for compatibility with existing formats and protocols, with
hashcrew::md5::md5(&[u8]) -> [u8; 16]and a streamingMd5state.digestreads the current result and allows furtherupdatecalls to extend the same message; the defaultstdfeature addsstd::io::Write.Keep the published crate dependency-free, allocation-free, and
no_stdcompatible. RustCrypto'smd-5is used only by development packages for differential tests and benchmarks; the public API does not depend onDigest.