From 84623ffaf9673310405ba48d3b4b36890a0abc29 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 20 Feb 2025 13:38:22 +1100 Subject: [PATCH] Add hash_again regression test Add a simple regression test prior to patching the `sha256::Hash::hash_again` function. --- hashes/tests/regression.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hashes/tests/regression.rs b/hashes/tests/regression.rs index 319d6ecf3..2bacd7ff2 100644 --- a/hashes/tests/regression.rs +++ b/hashes/tests/regression.rs @@ -87,3 +87,13 @@ fn regression_siphash24_with_key() { let want = "e823ed82311d601a"; assert_eq!(got, want); } + +#[test] +fn regression_sha256_hash_again() { + let hash = sha256::Hash::hash(b"Don't explain your philosophy. Embody it."); + let again = hash.hash_again(); + + let got = format!("{}", again); + let want = "28273103bcd88ab99e2b1007174770ff3f0ea91ee4b3ac942879ed1a2d264b4c"; + assert_eq!(got, want); +}