From 3b0c09cd5669adc017b5ba572905abf0d61fb639 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Mar 2026 16:16:44 +0000 Subject: [PATCH] Replace standalone md5 crate with RustCrypto md-5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The standalone `md5` (0.8.0) crate is replaced with `md-5` (0.10) from the RustCrypto ecosystem, which shares `digest v0.10` with sha2, argon2, blake2 and other crates already in the dependency tree — eliminating one redundant implementation. https://claude.ai/code/session_01V23pGpfNw5ujZvtwRFG6qy --- Cargo.toml | 2 +- src/infrastructure/services/chunked_upload_service.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 65d736d3..95c090ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ dotenvy = "0.15.7" moka = { version = "0.12", features = ["future", "sync"] } http-range-header = "0.4" image = { version = "0.25", default-features = false, features = ["jpeg", "png", "gif", "webp"] } -md5 = "0.8.0" +md-5 = "0.10" sha2 = "0.10.9" blake3 = { version = "1.8.3", features = ["rayon"] } hex = "0.4.3" diff --git a/src/infrastructure/services/chunked_upload_service.rs b/src/infrastructure/services/chunked_upload_service.rs index cfd94491..c8311487 100644 --- a/src/infrastructure/services/chunked_upload_service.rs +++ b/src/infrastructure/services/chunked_upload_service.rs @@ -496,7 +496,10 @@ impl ChunkedUploadService { if let Some(ref expected_checksum) = checksum { let data_clone = data.clone(); // Bytes::clone is O(1) — just an Arc increment let actual_checksum = - tokio::task::spawn_blocking(move || format!("{:x}", md5::compute(&data_clone))) + tokio::task::spawn_blocking(move || { + use md5::{Md5, Digest}; + format!("{:x}", Md5::digest(&data_clone)) + }) .await .map_err(|e| format!("MD5 checksum task failed: {e}"))?;