From a45b47da42c75c91145be0f1bf76fa329bbfe980 Mon Sep 17 00:00:00 2001 From: PiX <69745008+pixincreate@users.noreply.github.com> Date: Thu, 6 Aug 2026 13:51:17 +0530 Subject: [PATCH 1/2] fix: encode baseline hashes without LowerHex formatting --- src/baseline.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/baseline.rs b/src/baseline.rs index 502cf26..3e41ad1 100644 --- a/src/baseline.rs +++ b/src/baseline.rs @@ -24,7 +24,13 @@ fn hash_content(content: &str) -> String { let mut hasher = Sha256::new(); hasher.update(HASH_DOMAIN_SEPARATOR.as_bytes()); hasher.update(content.as_bytes()); - format!("{:x}", hasher.finalize()) + // Encode bytes manually: sha2 0.11 switched `finalize()` from GenericArray to + // hybrid_array::Array, which no longer implements LowerHex for `{:x}`. + hasher + .finalize() + .iter() + .map(|byte| format!("{:02x}", byte)) + .collect() } #[derive(Clone, Debug, PartialEq, Eq, Hash)] From 1539aff3eaf24eaa9c001a942c0613d7d4f166a0 Mon Sep 17 00:00:00 2001 From: PiX <69745008+pixincreate@users.noreply.github.com> Date: Thu, 6 Aug 2026 13:59:08 +0530 Subject: [PATCH 2/2] refactor: use hex crate for baseline hash encoding --- Cargo.lock | 7 +++++++ Cargo.toml | 1 + src/baseline.rs | 8 +------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da293a8..6c18674 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,6 +281,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "indexmap" version = "2.14.0" @@ -310,6 +316,7 @@ dependencies = [ "clap", "dirs", "glob", + "hex", "rayon", "regex", "serde", diff --git a/Cargo.toml b/Cargo.toml index c95b844..d215882 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ glob = "0.3.3" dirs = "6.0" rayon = "1" sha2 = "0.10" +hex = "0.4" [dev-dependencies] tempfile = "3" diff --git a/src/baseline.rs b/src/baseline.rs index 3e41ad1..d64e722 100644 --- a/src/baseline.rs +++ b/src/baseline.rs @@ -24,13 +24,7 @@ fn hash_content(content: &str) -> String { let mut hasher = Sha256::new(); hasher.update(HASH_DOMAIN_SEPARATOR.as_bytes()); hasher.update(content.as_bytes()); - // Encode bytes manually: sha2 0.11 switched `finalize()` from GenericArray to - // hybrid_array::Array, which no longer implements LowerHex for `{:x}`. - hasher - .finalize() - .iter() - .map(|byte| format!("{:02x}", byte)) - .collect() + hex::encode(hasher.finalize()) } #[derive(Clone, Debug, PartialEq, Eq, Hash)]