HMAC_SHA256.txt at [216b8859b8]

File tests/test_vectors/MAC/HMAC_SHA256.txt artifact 32c296d1a9 part of check-in 216b8859b8


# HMAC-SHA256
# From https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
# and RFC 4231 HMAC-SHA Identifiers and Test Vectors
# and RFC 6234 SHA and SHA-based HMAC and HKDF

[b = 64]
[L = 32]

Klen = 64
Tlen = 32
Len = 34
Msg = "Sample message for keylen=blocklen"
Key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
Mac = 8bb9a1db9806f20df7f77b82138c7914d174d59e13dc4d0169c9057b133e1d62

Klen = 32
Tlen = 32
Len = 34
Msg = "Sample message for keylen<blocklen"
Key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
Mac = a28cf43130ee696a98f14a37678b56bcfcbdd9e5cf69717fecf5480f0ebdf790

Klen = 100
Tlen = 32
Len = 34
Msg = "Sample message for keylen=blocklen"
Key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f60616263
Mac = bdccb6c72ddeadb500ae768386cb38cc41c63dbb0878ddb9c7a38a431b78378d

Klen = 49
Tlen = 16
Len = 54
Msg = "Sample message for keylen<blocklen, with truncated tag"
Key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30
Mac = 27a8b157839efeac98df070b331d593618ddb985d403c0c786d23b5d132e57c7
Trunc = 27a8b157839efeac98df070b331d5936

# RFC 4231 Test Case 1
Klen = 20
Tlen = 32
Len = 8
Key = 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
Msg = "Hi There"
#Msg = 4869205468657265
Mac = b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7

# RFC 4231 Test Case 2: Test with a key shorter than the length of the HMAC output.
Klen = 4
Tlen = 32
Len = 28
Key = "Jefe"
#Key = 4a656665
Msg = "what do ya want for nothing?"
#Msg = 7768617420646f2079612077616e7420666f72206e6f7468696e673f
Mac = 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843

# RFC 4231 Test Case 3: Test with a combined length of key and data that is larger than 64 bytes (= block-size of SHA-224 and SHA-256).
Klen = 20
Tlen = 32
Len = 50
Key = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Msg = dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Mac = 773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe

# RFC 4231 Test Case 4: Test with a combined length of key and data that is larger than 64 bytes (= block-size of SHA-224 and SHA-256).
Klen = 25
Tlen = 32
Len = 50
Key = 0102030405060708090a0b0c0d0e0f10111213141516171819
Msg = cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd
Mac = 82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b

# RFC 4231 Test Case 5: Test with a truncation of output to 128 bits.
Klen = 20
Tlen = 16
Len = 20
Key = 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
Msg = "Test With Truncation"
Mac = a3b6167473100ee06e0c796c2955552b
Trunc = a3b6167473100ee06e0c796c2955552b

# RFC 4231 Test Case 6: Test with a key larger than 128 bytes (= block-size of SHA-384 and SHA-512).
Klen = 131
Tlen = 32
Len = 54
Key =  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Msg = "Test Using Larger Than Block-Size Key - Hash Key First"
#Msg = 54657374205573696e67204c6172676572205468616e20426c6f636b2d53697a65204b6579202d2048617368204b6579204669727374
Mac = 60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54

# RFC 4231 Test Case 7: Test with a key and data that is larger than 128 bytes (= block-size of SHA-384 and SHA-512).
Klen = 131
Tlen = 32
Len = 152
Key = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Msg = "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm."
#Msg = 5468697320697320612074657374207573696e672061206c6172676572207468616e20626c6f636b2d73697a65206b657920616e642061206c6172676572207468616e20626c6f636b2d73697a6520646174612e20546865206b6579206e6565647320746f20626520686173686564206265666f7265206265696e6720757365642062792074686520484d414320616c676f726974686d2e
Mac = 9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2

# Wikipedia
Klen = 3
Tlen = 32
Len = 43
Key = "key"
Msg = "The quick brown fox jumps over the lazy dog"
Mac = f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8

# RFC 6234 Test Case 1
Klen = 20
Tlen = 32
Len = 8
Key = 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
Msg = "Hi There"
#Msg = 4869205468657265
Mac = b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7

# RFC 6234 Test Case 2
Klen = 4
Tlen = 32
Len = 28
Key = "Jefe"
#Key = 4a656665
Msg = "what do ya want for nothing?"
#Msg = 7768617420646f2079612077616e7420666f72206e6f7468696e673f
Mac = 5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843

# RFC 6234 Test Case 3
Klen = 20
Tlen = 32
Len = 50
Key = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Msg = dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Mac = 773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe

# RFC 6234 Test Case 4
Klen = 25
Tlen = 32
Len = 50
Key = 0102030405060708090a0b0c0d0e0f10111213141516171819
Msg = cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd
Mac = 82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b

# RFC 6234 Test Case 5
Klen = 20
Tlen = 16
Len = 20
Key = 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c
Msg = "Test With Truncation"
Mac = a3b6167473100ee06e0c796c2955552b

# RFC 6234 Test Case 6
Klen = 131
Tlen = 32
Len = 54
Key = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Msg = "Test Using Larger Than Block-Size Key - Hash Key First"
Mac = 60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54

# RFC 6234 Test Case 7
Klen = 131
Tlen = 32
Len = 152
Key = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Msg = "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm."
Mac = 9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2