HMAC_SHA512.test at [59eac2fc22]

File tests/test_vectors/MAC/HMAC_SHA512.test artifact c035b2c1e6 part of check-in 59eac2fc22


# Auto generated from "HMAC_SHA512.txt"
lappend auto_path [file dirname [file dirname [file dirname [file dirname [file join [pwd] [info script]]]]]]
package require tls
package require tcltest

tcltest::testConstraint HMAC [expr {[lsearch -nocase [tls::macs] HMAC] > -1}]
tcltest::testConstraint SHA512 [expr {[lsearch -nocase [tls::digests] SHA512] > -1}]
catch {tls::provider legacy}

tcltest::test MAC_HMAC-SHA512-1.1 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f] -data "Sample message for keylen=blocklen"] 0 127} \
	-match exact -result fc25e240658ca785b7a811a8d3f7b4ca48cfa26a8a366bf2cd1f836b05fcb024bd36853081811d6cea4216ebad79da1cfcb95ea4586b8a0ce356596a55fb1347

tcltest::test MAC_HMAC-SHA512-1.2 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f] -data "Sample message for keylen<blocklen"] 0 127} \
	-match exact -result fd44c18bda0bb0a6ce0e82b031bf2818f6539bd56ec00bdc10a8a2d730b3634de2545d639b0f2cf710d0692c72a1896f1f211c2b922d1a96c392e07e7ea9fedc

tcltest::test MAC_HMAC-SHA512-1.3 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7] -data "Sample message for keylen=blocklen"] 0 127} \
	-match exact -result d93ec8d2de1ad2a9957cb9b83f14e76ad6b5e0cce285079a127d3b14bccb7aa7286d4ac0d4ce64215f2bc9e6870b33d97438be4aaa20cda5c5a912b48b8e27f3

tcltest::test MAC_HMAC-SHA512-1.4 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30] -data "Sample message for keylen<blocklen, with truncated tag"] 0 63} \
	-match exact -result 00f3e9a77bb0f06de15f160603e42b5028758808596664c03e1ab8fb2b076778

tcltest::test MAC_HMAC-SHA512-1.5 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b] -data "Hi There"] 0 127} \
	-match exact -result 87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854

tcltest::test MAC_HMAC-SHA512-1.6 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key "Jefe" -data "what do ya want for nothing?"] 0 127} \
	-match exact -result 164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737

tcltest::test MAC_HMAC-SHA512-1.7 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] -data [binary decode hex dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd]] 0 127} \
	-match exact -result fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb

tcltest::test MAC_HMAC-SHA512-1.8 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 0102030405060708090a0b0c0d0e0f10111213141516171819] -data [binary decode hex cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd]] 0 127} \
	-match exact -result b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd

tcltest::test MAC_HMAC-SHA512-1.9 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c] -data "Test With Truncation"] 0 31} \
	-match exact -result 415fad6271580a531d4179bc891d87a6

tcltest::test MAC_HMAC-SHA512-1.10 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] -data "Test Using Larger Than Block-Size Key - Hash Key First"] 0 127} \
	-match exact -result 80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598

tcltest::test MAC_HMAC-SHA512-1.11 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] -data "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."] 0 127} \
	-match exact -result e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58

tcltest::test MAC_HMAC-SHA512-1.12 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key "key" -data "The quick brown fox jumps over the lazy dog"] 0 127} \
	-match exact -result b42af09057bac1e2d41708e48a902e09b5ff7f12ab428a4fe86653c73dd248fb82f948a549f7b791a5b41915ee4d1ec3935357e4e2317250d0372afa2ebeeb3a

tcltest::test MAC_HMAC-SHA512-1.13 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b] -data "Hi There"] 0 127} \
	-match exact -result 87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854

tcltest::test MAC_HMAC-SHA512-1.14 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key "Jefe" -data "what do ya want for nothing?"] 0 127} \
	-match exact -result 164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737

tcltest::test MAC_HMAC-SHA512-1.15 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] -data [binary decode hex dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd]] 0 127} \
	-match exact -result fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb

tcltest::test MAC_HMAC-SHA512-1.16 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 0102030405060708090a0b0c0d0e0f10111213141516171819] -data [binary decode hex cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd]] 0 127} \
	-match exact -result b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd

tcltest::test MAC_HMAC-SHA512-1.17 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex 0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c] -data "Test With Truncation"] 0 31} \
	-match exact -result 415fad6271580a531d4179bc891d87a6

tcltest::test MAC_HMAC-SHA512-1.18 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] -data "Test Using Larger Than Block-Size Key - Hash Key First"] 0 127} \
	-match exact -result 80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598

tcltest::test MAC_HMAC-SHA512-1.19 {HMAC_SHA512} \
	-constraints {HMAC SHA512 } \
	-setup {} \
	-body {string range [tls::hmac -hex -digest SHA512 -key [binary decode hex aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] -data "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."] 0 127} \
	-match exact -result e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58

# Cleanup
::tcltest::cleanupTests
return