Make Hmac rekey-initializable (like Arc4Gen)

This commit is contained in:
hashlag committed 2025-08-26 00:37:13 +03:00
1 parent 30e7740eae
commit 8843589950
2 files changed
+49 -3

No files matched your search

+13
View File
@@ -72,3 +72,16 @@ TEST(HmacTests, LongKeyTest)
ASSERT_EQ("99459b85e800f3e5eab24e1c945794f8", hmacMd5(key, data));
}
}
TEST(HmacTests, UninitializedHmacTest)
{
std::array<uint8_t, 10> in;
in.fill(0);
{
Hmac<Md5Hasher> hmac;
ASSERT_THROW(hmac.Update(in.begin(), in.end()), Chaos::Service::ChaosException);
ASSERT_THROW(hmac.Finish(), Chaos::Service::ChaosException);
}
}