What changed, and why it matters
This commit only adds a new automated test for an existing function called hash_64_many. It does not change any production code, fix a bug, or alter behavior. There is no security issue here.
Recommended action
No action needed; this is a benign test-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a unit test in hashes/src/sha256d/mod.rs that exercises sha256d::Hash::hash_64_many with input block counts from 0 to 32, comparing outputs against the single-block sha256d::hash reference. No implementation code is modified.
Changed components
hashes/src/sha256d/mod.rsInspect captured patch +24 / −0
diff --git a/hashes/src/sha256d/mod.rs b/hashes/src/sha256d/mod.rs
index 0c49d015..64b82efc 100644
--- a/hashes/src/sha256d/mod.rs
+++ b/hashes/src/sha256d/mod.rs
@@ -141,4 +141,28 @@ mod tests {
&[Token::Str("6cfb35868c4465b7c289d7d5641563aa973db6a929655282a7bf95c8257f53ef")],
);
}
+
+ #[test]
+ #[cfg(feature = "alloc")]
+ fn hash_64_many() {
+ for count in 0..=32 {
+ let inputs: alloc::vec::Vec<[u8; 64]> = (0..count)
+ .map(|i: usize| {
+ let mut block = [0u8; 64];
+ for (j, byte) in block.iter_mut().enumerate() {
+ *byte = (i * 64 + j) as u8;
+ }
+ block
+ })
+ .collect();
+
+ let expected: alloc::vec::Vec<[u8; 32]> =
+ inputs.iter().map(|inp| sha256d::hash(inp).to_byte_array()).collect();
+
+ let mut outputs = alloc::vec![[0u8; 32]; count];
+ sha256d::Hash::hash_64_many(&mut outputs, &inputs);
+
+ assert_eq!(outputs, expected);
+ }
+ }
}
Risk score
Our methodology →Why this scored 15/100
Human-validated context
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
No validated notes yet.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.