SymCrypt/unittest/kat_streamcipher.dat

165 строки
8.0 KiB
Plaintext

#
#Known answer test vectors for Blockciphers
#
# This file format is based on the FAX files that Atlan gave us with test vectors for FIPS algorithms.
# Many of the test vectors also come from them.
#
# Binary data fields can be one of the following formats
# - string of hex characters
# - Double-quoted string for ASCII strings (no terminating zero is added to the data)
# - 'repeat(<int)' followed by a data field
#
[Rc4]
# test vectors from Wikipedia entry on RC4
key = "Key"
plaintext = "Plaintext"
ciphertext = BBF316E8D940AF0AD3
key = "Wiki"
plaintext = "pedia"
ciphertext = 1021BF0420
key = "Secret"
plaintext = "Attack at dawn"
ciphertext = 45A01F645FC35B383552544B9BF5
rrep = 10000
rnd = 5ac1dc409a945d678026230d7f1b3e86
[ChaCha20]
# test vectors from RFC 7539
# RFC 7539 section 2.4.2
key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
nonce = 000000000000004a00000000
offset = 64
plaintext = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."
ciphertext = 6e2e359a2568f98041ba0728dd0d6981e97e7aec1d4360c20a27afccfd9fae0bf91b65c5524733ab8f593d\
abcd62b3571639d624e65152ab8f530c359f0861d807ca0dbf500d6a6156a38e088a22b65e52bc514d16cc\
f806818ce91ab77937365af90bbf74a35be6b40b8eedf2785e42874d
# RFC 7539 section 2.6.2
key = 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
nonce = 000000000001020304050607
plaintext = 0000000000000000000000000000000000000000000000000000000000000000
ciphertext = 8ad5a08b905f81cc815040274ab29471a833b637e3fd0da508dbb8e2fdd1a646
# RFC 7539 section 2.8.2
key = 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
nonce = 070000004041424344454647
plaintext = 0000000000000000000000000000000000000000000000000000000000000000
ciphertext = 7bac2b252db447af09b67a55a4e955840ae1d6731075d9eb2a9375783ed553ff
# RFC 7539 section 2.8.2
key = 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
nonce = 070000004041424344454647
offset = 64
plaintext = "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."
ciphertext = d31a8d34648e60db7b86afbc53ef7ec2a4aded51296e08fea9e2b5a736ee62d63dbea45e8ca9671282fafb\
69da92728b1a71de0a9e060b2905d6a5b67ecd3b3692ddbd7f2d778b8c9803aee328091b58fab324e4fad6\
75945585808b4831d7bc3ff4def08e4b7a9de576d26586cec64b6116
# RFC 7539 appendix A
# A.1 ChaCha20 Block function
# vector #1
key = 0000000000000000000000000000000000000000000000000000000000000000
nonce = 000000000000000000000000
offset = 0
plaintext = repeat(64) 00
ciphertext = 76b8e0ada0f13d90405d6ae55386bd28bdd219b8a08ded1aa836efcc8b770dc7da41597c5157488d7724e0\
3fb8d84a376a43b8f41518a11cc387b669b2ee6586
# vector #2
key = 0000000000000000000000000000000000000000000000000000000000000000
nonce = 000000000000000000000000
offset = 64
plaintext = repeat(64) 00
ciphertext = 9f07e7be5551387a98ba977c732d080dcb0f29a048e3656912c6533e32ee7aed29b721769ce64e43d57133\
b074d839d531ed1f28510afb45ace10a1f4b794d6f
# vector #3
key = 0000000000000000000000000000000000000000000000000000000000000001
nonce = 000000000000000000000000
offset = 64
plaintext = repeat(64) 00
ciphertext = 3aeb5224ecf849929b9d828db1ced4dd832025e8018b8160b82284f3c949aa5a8eca00bbb4a73bdad192b5\
c42f73f2fd4e273644c8b36125a64addeb006c13a0
# vector #4
key = 00ff000000000000000000000000000000000000000000000000000000000000
nonce = 000000000000000000000000
offset = 128
plaintext = repeat(64) 00
ciphertext = 72d54dfbf12ec44b362692df94137f328fea8da73990265ec1bbbea1ae9af0ca13b25aa26cb4a648cb9b9d\
1be65b2c0924a66c54d545ec1b7374f4872e99f096
# vector #5
key = 0000000000000000000000000000000000000000000000000000000000000000
nonce = 000000000000000000000002
offset = 0
plaintext = repeat(64) 00
ciphertext = c2c64d378cd536374ae204b9ef933fcd1a8b2288b3dfa49672ab765b54ee27c78a970e0e955c14f3a88e74\
1b97c286f75f8fc299e8148362fa198a39531bed6d
# A.2 ChaCha20 encryption
# vector #1
# same as A.1 vector #1
# vector #2
key = 0000000000000000000000000000000000000000000000000000000000000001
nonce = 000000000000000000000002
offset = 64
plaintext = 416e79207375626d697373696f6e20746f20746865204945544620696e74656e6465642062792074686520\
436f6e7472696275746f7220666f72207075626c69636174696f6e20617320616c6c206f72207061727420\
6f6620616e204945544620496e7465726e65742d4472616674206f722052464320616e6420616e79207374\
6174656d656e74206d6164652077697468696e2074686520636f6e74657874206f6620616e204945544620\
616374697669747920697320636f6e7369646572656420616e20224945544620436f6e747269627574696f\
6e222e20537563682073746174656d656e747320696e636c756465206f72616c2073746174656d656e7473\
20696e20494554462073657373696f6e732c2061732077656c6c206173207772697474656e20616e642065\
6c656374726f6e696320636f6d6d756e69636174696f6e73206d61646520617420616e792074696d65206f\
7220706c6163652c207768696368206172652061646472657373656420746f
ciphertext = a3fbf07df3fa2fde4f376ca23e82737041605d9f4f4f57bd8cff2c1d4b7955ec2a97948bd3722915c8f3d3\
37f7d370050e9e96d647b7c39f56e031ca5eb6250d4042e02785ececfa4b4bb5e8ead0440e20b6e8db09d8\
81a7c6132f420e52795042bdfa7773d8a9051447b3291ce1411c680465552aa6c405b7764d5e87bea85ad0\
0f8449ed8f72d0d662ab052691ca66424bc86d2df80ea41f43abf937d3259dc4b2d0dfb48a6c9139ddd7f7\
6966e928e635553ba76c5c879d7b35d49eb2e62b0871cdac638939e25e8a1e0ef9d5280fa8ca328b351c3c\
765989cbcf3daa8b6ccc3aaf9f3979c92b3720fc88dc95ed84a1be059c6499b9fda236e7e818b04b0bc39c\
1e876b193bfe5569753f88128cc08aaa9b63d1a16f80ef2554d7189c411f5869ca52c5b83fa36ff216b9c1\
d30062bebcfd2dc5bce0911934fda79a86f6e698ced759c3ff9b6477338f3da4f9cd8514ea9982ccafb341\
b2384dd902f3d1ab7ac61dd29c6f21ba5b862f3730e37cfdc4fd806c22f221
# vector #3
key = 1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0
nonce = 000000000000000000000002
offset = 2688
plaintext = 2754776173206272696c6c69672c20616e642074686520736c6974687920746f7665730a44696420677972\
6520616e642067696d626c6520696e2074686520776162653a0a416c6c206d696d73792077657265207468\
6520626f726f676f7665732c0a416e6420746865206d6f6d65207261746873206f757467726162652e
ciphertext = 62e6347f95ed87a45ffae7426f27a1df5fb69110044c0d73118effa95b01e5cf166d3df2d721caf9b21e5f\
b14c616871fd84c54f9d65b283196c7fe4f60553ebf39c6402c42234e32a356b3e764312a61a5532055716\
ead6962568f87d3f3f7704c6a8d1bcd1bf4d50d6154b6da731b187b58dfd728afa36757a797ac188d1
# self-generated long message to allow the tester to find all corner cases on partial and random-access calls
key = 0123456789abcdef00112233445566778899aabbccddeefffedcba9876543210
nonce = 0101020305080d1522375990
plaintext = 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000\
00000000
ciphertext = 3b32be72b84caa455f8cf05d4b3661c6a4709079d45430aae0841920232f0cc8be796afc3607e854b4980f\
94d2cb28f1a5bc2495c3fdfa9a5196fe5ed1b5a9b13461d2f6a93f15a0fdee36d29c316142e206a1fa0958\
b62e47a0eab2c37d9c6f1b6c73f73fd98bebc7ca8a74a41bb06bd2bed7c15cd2360cd55ee016282b5aaccd\
383e201e6af58e34b8c4fb3fde4213e67acd2853f15142c762e81ccef46fc8db273f561c52d268e98dccf7\
4d71e8eb76943513a16b5a6d4e56af2a5588a44935c0380e77e8ee1ceada8916f2ed14fff3b58214f1e59e\
8baff5959dd8745738ac6867c552244b95dd850589b156772af93cad5cc79e97c8d5e4047c6161fd0b1662\
d6c7f549
rrep = 10000
rnd = 96784c736ee02cae698d9d416c4095ef