From 889516bb504a7eb7172b1382566110e29bdbd15b Mon Sep 17 00:00:00 2001 From: siddharth Date: Fri, 21 Jan 2022 19:30:01 -0500 Subject: lib: add test for `sha1('')` --- lib/sha1_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/sha1_test.go b/lib/sha1_test.go index 764e9ea..d2c8a32 100644 --- a/lib/sha1_test.go +++ b/lib/sha1_test.go @@ -41,6 +41,15 @@ func TestSha1Hash(t *testing.T) { if BytesToHexStr(h) != e { t.Errorf("sha1 test 3 failed: %x != %s\n", h, e) } + + // Test 4 + m = "" + sha1.Message(StrToBytes(m)) + h = sha1.Hash() + e = "da39a3ee5e6b4b0d3255bfef95601890afd80709" // Expected hash. + if BytesToHexStr(h) != e { + t.Errorf("sha1 test 3 failed: %x != %s\n", h, e) + } } // Test cases from RFC 2202 -- cgit v1.2.3