diff options
author | siddharth <s@ricketyspace.net> | 2022-01-21 19:30:01 -0500 |
---|---|---|
committer | siddharth <s@ricketyspace.net> | 2022-01-21 19:30:01 -0500 |
commit | 889516bb504a7eb7172b1382566110e29bdbd15b (patch) | |
tree | 34ec796c35d76e1c4d3fd676b372e9872c320027 /lib | |
parent | 3a61ba602fbf42fb8be24ac86198376725704719 (diff) |
lib: add test for `sha1('')`
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sha1_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
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 |