Files
rustfs/crates
唐小鸭 f3965512c1 refactor(rio): hash ETag and Content-MD5 through rustfs-utils Md5Stream
rio no longer depends on `md-5` for production code. `EtagReader` and the
`x-amz-checksum-md5` shell `Md5Hasher` both go through
`rustfs_utils::hash::Md5Stream`, so the ETag path, the Content-MD5 check
and the additional-checksum path can never disagree about which MD5
implementation is in use.

`EtagReader` keeps the hasher as `Option<Md5Stream>` and consumes it
exactly once on the poll that observes EOF; `get_etag` becomes
`&self -> Option<String>` and is `None` before EOF (no partial digest is
ever handed out). The tree has no pre-EOF caller: `try_resolve_etag` only
asks after `finished`. `BadDigest`, the comparison point and the hex
encoding are unchanged. `Md5Hasher::finalize(&mut self)` is now
`finalize_reset`, which `HashReader` calls exactly once at EOF.

`md-5` moves to dev-dependencies so test expectations still come from an
implementation independent of the one under test.

Tests: EtagReader with a tiny-capacity inner reader, reads after EOF,
a transient inner `Err` that must not count as EOF nor corrupt the digest,
`Pending` interleaved between chunks, and the calculated digest staying
observable after a mismatch; `Md5Hasher` finalize/restart/reset contract
through both the concrete type and `ChecksumType::MD5.hasher()`;
Content-MD5 match and typed `BadDigest` mismatch through the full
`HashReader` stack; MD5 added to the rio/checksums shared known-answer
vector table.
2026-09-17 10:25:15 +08:00
..