Files
rustfs/crates/utils
唐小鸭 b6312ef37f refactor(utils): route MD5 through a single streaming interface
`crates/utils/src/hash.rs` is the one place RustFS is meant to touch a
concrete MD5 implementation, but it only offered the one-shot shape
(`HashAlgorithm::hash_encode`), so the streaming consumers in rio kept
their own `md-5` dependency and `use md5::Digest` imports.

Add `hash_stream.rs` with `Md5Stream`: new / update / consuming
`finalize` / `finalize_reset` / one-shot `digest`, plus `io::Write` and an
opaque `Debug`. The backend lives in a private module with exactly one
implementation compiled in (RustCrypto `md-5` today); adding another means
adding one `Md5Inner` behind a cargo feature there and nothing else in the
tree changes. `Md5Stream` deliberately has no `Clone` and a consuming
`finalize`: that is the intersection of what any backend can offer, so a
backend switch can never surface as a compile error elsewhere.

`HashAlgorithm::Md5` now delegates to `Md5Stream`; `hash.rs` no longer
names `md5::Md5`. Behaviour is unchanged: the same `md-5` crate computes
the same digests.

Tests: RFC 1321 A.5 vectors (one-shot, byte-at-a-time, and through
`HashAlgorithm::Md5`), splits on every 64-byte block and padding edge,
`finalize_reset` sequences, `Write` delegation, and a proptest
differential oracle against `md-5` called directly, which becomes the
independent reference once a second backend exists. `hash_stream.rs` is at
100% line coverage. The bench gains a 256 KiB-chunked streaming entry that
models how `EtagReader` is actually fed.
2026-09-17 10:25:15 +08:00
..
2025-12-08 11:23:24 +08:00

RustFS

RustFS Utils - Utility Functions

Essential utility functions and common tools for RustFS distributed object storage

CI 📖 Documentation · 🐛 Bug Reports · 💬 Discussions


📖 Overview

RustFS Utils provides essential utility functions and common tools for the RustFS distributed object storage system. For the complete RustFS experience, please visit the main RustFS repository.

✨ Features

  • Cross-platform system operations and monitoring
  • File system utilities with atomic operations
  • Multi-algorithm compression and encoding support
  • Cryptographic utilities and secure key generation
  • Network utilities and protocol helpers
  • Certificate handling and validation tools

📚 Documentation

For comprehensive documentation, examples, and usage guides, please visit the main RustFS repository.

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.