Skip to content

Commit

Permalink
[dev.boringcrypto] crypto/hmac: test empty key
Browse files Browse the repository at this point in the history
This happens in the scrypt and pbkdf unit tests.

Change-Id: I1eda944d7c01d28c7a6dd9f428f5fdd1cbd58939
Reviewed-on: https://go-review.googlesource.com/59771
Reviewed-by: Adam Langley <agl@golang.org>
  • Loading branch information
rsc committed Aug 30, 2017
1 parent f6358bd commit 81b9d73
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/crypto/hmac/hmac_test.go
Expand Up @@ -518,6 +518,31 @@ var hmacTests = []hmacTest{
sha512.Size,
sha512.BlockSize,
},
// HMAC without key is dumb but should probably not fail.
{
sha1.New,
[]byte{},
[]byte("message"),
"d5d1ed05121417247616cfc8378f360a39da7cfa",
sha1.Size,
sha1.BlockSize,
},
{
sha256.New,
[]byte{},
[]byte("message"),
"eb08c1f56d5ddee07f7bdf80468083da06b64cf4fac64fe3a90883df5feacae4",
sha256.Size,
sha256.BlockSize,
},
{
sha512.New,
[]byte{},
[]byte("message"),
"08fce52f6395d59c2a3fb8abb281d74ad6f112b9a9c787bcea290d94dadbc82b2ca3e5e12bf2277c7fedbb0154d5493e41bb7459f63c8e39554ea3651b812492",
sha512.Size,
sha512.BlockSize,
},
}

func TestHMAC(t *testing.T) {
Expand Down

0 comments on commit 81b9d73

Please sign in to comment.