From 4ae55f93fc8bffe9dea77ddf60ac3bb05e288c83 Mon Sep 17 00:00:00 2001 From: hashlag Date: Thu, 29 Jan 2026 00:28:16 +0300 Subject: [PATCH] Sha1HasherTests: Add a longer than 56 (mod 64) byte message testcase --- ChaosTests/Hash/Sha1HasherTests.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ChaosTests/Hash/Sha1HasherTests.cpp b/ChaosTests/Hash/Sha1HasherTests.cpp index 145a181..2fce13a 100644 --- a/ChaosTests/Hash/Sha1HasherTests.cpp +++ b/ChaosTests/Hash/Sha1HasherTests.cpp @@ -116,6 +116,24 @@ TEST(Sha1Tests, PartialUpdateTest) ASSERT_EQ("50abf5706a150990a08b2c5ea40fa0e585554732", hasher.Finish().ToHexString()); } + + { + // > 56 (mod 64) bytes. + // "01234567012345670123456701234567012345670123456701234567012" + Sha1Hasher hasher; + + { + const char * in = "0123456701234567012345670"; + hasher.Update(in, in + strlen(in)); + } + + { + const char * in = "1234567012345670123456701234567012"; + hasher.Update(in, in + strlen(in)); + } + + ASSERT_EQ("48a2aded798429970468e8aa77bdc1840dbca3fe", hasher.Finish().ToHexString()); + } } TEST(Sha1Tests, LongInputTest)