1 # HMAC-SHA-256 test vectors from draft-ietf-ipsec-ciph-sha-256-01.txt
6 use Digest::SHA qw(hmac_sha256_hex);
20 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
21 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopqabcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
23 "what do ya want for nothing?",
26 "Test With Truncation",
27 "Test Using Larger Than Block-Size Key - Hash Key First",
28 "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data"
30 plan tests => scalar(@data);
33 my $k1 = pack("H*", "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20");
34 my $k2 = pack("H*", "0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425");
50 "a21b1f5d4cf4f73a4dd939750f7a066a7f98cc131cb16a6692759021cfab8181",
51 "104fdc1257328f08184ba73131c53caee698e36119421149ea8c712456697d30",
52 "470305fc7e40fe34d3eeb3e773d95aab73acf0fd060447a5eb4595bf33a9d1a3",
53 "198a607eb44bfbc69903a0f1cf2bbdc5ba0aa3f3d9ae3c1c7a3b1696a0b68cf7",
54 "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843",
55 "cdcb1220d1ecccea91e53aba3092f962e549fe6ce9ed7fdc43191fbde45c30b0",
56 "d4633c17f6fb8d744c66dee0f8f074556ec4af55ef07998541468eb49bd2e917",
57 "7546af01841fc09b1ab9c3749a5f1c17d4f589668a587b2700a9c97c1193cf42",
58 "6953025ed96f0c09f80a96f78e6538dbe2e7b820e3dd970e7ddd39091b32352f",
59 "6355ac22e890d0a3c8481a5ca4825bc884d3e7a1ff98a2fc2ac7d8e064c3b2e6"
62 # do the first one by hand to test multi-argument data feed
64 ok(hmac_sha256_hex("a", "b", "c", $k1), $hmac256rsp[0]);
66 for (my $i = 1; $i < @data; $i++) {
68 hmac_sha256_hex($data[$i], $key[$i]),