Skip to content

feat: add md5 hashing - #22

Merged
tisonkun merged 3 commits into
mainfrom
codex/md5
Sep 8, 2026
Merged

feat: add md5 hashing#22
tisonkun merged 3 commits into
mainfrom
codex/md5

Conversation

@tisonkun

@tisonkun tisonkun commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Add MD5 for compatibility with existing formats and protocols, with hashcrew::md5::md5(&[u8]) -> [u8; 16] and a streaming Md5 state. digest reads the current result and allows further update calls to extend the same message; the default std feature adds std::io::Write.

Keep the published crate dependency-free, allocation-free, and no_std compatible. RustCrypto's md-5 is used only by development packages for differential tests and benchmarks; the public API does not depend on Digest.

@tisonkun

tisonkun commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@leiysky I'm considering include MD5, CRC, and perhaps FxHash in hashcrew crate, under the scope definition as:

Fast, portable hashing for non-cryptographic use.

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).

@tisonkun
tisonkun requested review from leiysky and a lite review from Copilot September 7, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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::md5 module with one-shot md5(&[u8]) -> [u8; 16] and a streaming Md5 state whose digest() is non-consuming and supports continued update() calls.
  • Adds integration tests and benchmarks that compare hashcrew MD5 outputs against RustCrypto’s md-5 crate (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.

@tisonkun
tisonkun merged commit f08de96 into main Sep 8, 2026
11 checks passed
@tisonkun
tisonkun deleted the codex/md5 branch September 8, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants