cryptopp 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/MIT-LICENSE +22 -0
- data/README +7 -0
- data/Rakefile +42 -0
- data/cryptopp.gemspec +199 -0
- data/ext/.gitignore +5 -0
- data/ext/Rakefile +16 -0
- data/ext/ciphers.cpp +1402 -0
- data/ext/cryptopp.cpp +285 -0
- data/ext/cryptopp_ruby_api.h +139 -0
- data/ext/defs/block_modes.def +10 -0
- data/ext/defs/checksums.def +10 -0
- data/ext/defs/ciphers.def +136 -0
- data/ext/defs/hashes.def +78 -0
- data/ext/defs/hmacs.def +54 -0
- data/ext/defs/paddings.def +9 -0
- data/ext/defs/rngs.def +7 -0
- data/ext/digests.cpp +1120 -0
- data/ext/extconf.rb +39 -0
- data/ext/j3way.cpp +22 -0
- data/ext/j3way.h +29 -0
- data/ext/jadler32.h +32 -0
- data/ext/jaes.cpp +22 -0
- data/ext/jaes.h +31 -0
- data/ext/jarc4.cpp +22 -0
- data/ext/jarc4.h +37 -0
- data/ext/jbase.cpp +172 -0
- data/ext/jbase.h +92 -0
- data/ext/jbasiccipherinfo.h +74 -0
- data/ext/jblowfish.cpp +22 -0
- data/ext/jblowfish.h +29 -0
- data/ext/jcamellia.cpp +24 -0
- data/ext/jcamellia.h +33 -0
- data/ext/jcast128.cpp +22 -0
- data/ext/jcast128.h +31 -0
- data/ext/jcast256.cpp +22 -0
- data/ext/jcast256.h +31 -0
- data/ext/jcipher.cpp +112 -0
- data/ext/jcipher.h +42 -0
- data/ext/jcipher_t.h +469 -0
- data/ext/jconfig.h +127 -0
- data/ext/jconstants.h +189 -0
- data/ext/jcrc32.h +32 -0
- data/ext/jdes.cpp +22 -0
- data/ext/jdes.h +31 -0
- data/ext/jdes_ede2.cpp +22 -0
- data/ext/jdes_ede2.h +31 -0
- data/ext/jdes_ede3.cpp +22 -0
- data/ext/jdes_ede3.h +31 -0
- data/ext/jdes_xex3.cpp +22 -0
- data/ext/jdes_xex3.h +31 -0
- data/ext/jdiamond2.cpp +22 -0
- data/ext/jdiamond2.h +31 -0
- data/ext/jdiamond2lite.cpp +22 -0
- data/ext/jdiamond2lite.h +31 -0
- data/ext/jexception.h +20 -0
- data/ext/jgost.cpp +22 -0
- data/ext/jgost.h +31 -0
- data/ext/jhash.cpp +92 -0
- data/ext/jhash.h +54 -0
- data/ext/jhash_t.h +121 -0
- data/ext/jhaval.h +64 -0
- data/ext/jhelpers.cpp +90 -0
- data/ext/jhelpers.h +38 -0
- data/ext/jhmac.cpp +44 -0
- data/ext/jhmac.h +34 -0
- data/ext/jhmac_t.h +125 -0
- data/ext/jidea.cpp +22 -0
- data/ext/jidea.h +31 -0
- data/ext/jmarc4.cpp +22 -0
- data/ext/jmarc4.h +37 -0
- data/ext/jmars.cpp +22 -0
- data/ext/jmars.h +31 -0
- data/ext/jmd2.h +56 -0
- data/ext/jmd4.h +56 -0
- data/ext/jmd5.h +56 -0
- data/ext/jpanamacipher.cpp +32 -0
- data/ext/jpanamacipher.h +46 -0
- data/ext/jpanamahash.h +44 -0
- data/ext/jrc2.cpp +44 -0
- data/ext/jrc2.h +39 -0
- data/ext/jrc5.cpp +22 -0
- data/ext/jrc5.h +31 -0
- data/ext/jrc6.cpp +22 -0
- data/ext/jrc6.h +31 -0
- data/ext/jripemd160.h +113 -0
- data/ext/jsafer.cpp +32 -0
- data/ext/jsafer.h +42 -0
- data/ext/jseal.cpp +32 -0
- data/ext/jseal.h +42 -0
- data/ext/jserpent.cpp +22 -0
- data/ext/jserpent.h +31 -0
- data/ext/jsha.h +122 -0
- data/ext/jshacal2.cpp +22 -0
- data/ext/jshacal2.h +31 -0
- data/ext/jshark.cpp +24 -0
- data/ext/jshark.h +33 -0
- data/ext/jsink.cpp +90 -0
- data/ext/jsink.h +154 -0
- data/ext/jskipjack.cpp +22 -0
- data/ext/jskipjack.h +31 -0
- data/ext/jsquare.cpp +22 -0
- data/ext/jsquare.h +31 -0
- data/ext/jstream.cpp +8 -0
- data/ext/jstream.h +20 -0
- data/ext/jstream_t.h +175 -0
- data/ext/jtea.cpp +22 -0
- data/ext/jtea.h +31 -0
- data/ext/jtiger.h +52 -0
- data/ext/jtwofish.cpp +22 -0
- data/ext/jtwofish.h +31 -0
- data/ext/jwhirlpool.h +52 -0
- data/ext/utils.cpp +8 -0
- data/extras/parser_c.rb +114 -0
- data/test/ciphers_test.rb +37 -0
- data/test/data/ciphers/3desval.dat +7 -0
- data/test/data/ciphers/3wayval.dat +6 -0
- data/test/data/ciphers/arc4.dat +8 -0
- data/test/data/ciphers/blowfish.dat +5 -0
- data/test/data/ciphers/camellia.dat +7 -0
- data/test/data/ciphers/cast128v.dat +5 -0
- data/test/data/ciphers/cast256v.dat +5 -0
- data/test/data/ciphers/descert.dat +198 -0
- data/test/data/ciphers/diamond.dat +9 -0
- data/test/data/ciphers/gostval.dat +10 -0
- data/test/data/ciphers/ideaval.dat +13 -0
- data/test/data/ciphers/marsval.dat +11 -0
- data/test/data/ciphers/panamac.dat +7 -0
- data/test/data/ciphers/rc2val.dat +10 -0
- data/test/data/ciphers/rc5val.dat +7 -0
- data/test/data/ciphers/rc6val.dat +8 -0
- data/test/data/ciphers/rijndael.dat +11 -0
- data/test/data/ciphers/saferval.dat +27 -0
- data/test/data/ciphers/seal.dat +3 -0
- data/test/data/ciphers/serpentv.dat +11 -0
- data/test/data/ciphers/shacal2.dat +7 -0
- data/test/data/ciphers/sharkval.dat +9 -0
- data/test/data/ciphers/skipjack.dat +3 -0
- data/test/data/ciphers/squareva.dat +10 -0
- data/test/data/ciphers/twofishv.dat +11 -0
- data/test/data/digests/adler32.dat +8 -0
- data/test/data/digests/crc32.dat +10 -0
- data/test/data/digests/haval.dat +4 -0
- data/test/data/digests/havalcer.dat +23 -0
- data/test/data/digests/md2.dat +9 -0
- data/test/data/digests/md4.dat +9 -0
- data/test/data/digests/md5.dat +9 -0
- data/test/data/digests/panamah.dat +8 -0
- data/test/data/digests/ripemd.dat +43 -0
- data/test/data/digests/sha.dat +19 -0
- data/test/data/digests/tiger.dat +11 -0
- data/test/data/digests/whirlpool.dat +13 -0
- data/test/data/hmacs/hmac.dat +6 -0
- data/test/digests_test.rb +29 -0
- data/test/hmacs_test.rb +38 -0
- data/test/test_helper.rb +42 -0
- metadata +220 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
algorithm cipher diamond2
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex rounds
|
3
|
+
test e834fdb933c502923d92bc9e14368e70d41c66cbdf36155033a66e07e6cc6d8d 5a8d872d31eedde63fc46f6c36456d8e 39b60490aeef791a29015d74494aaa89 15
|
4
|
+
test 599b02fbd0d321a789eb97b388bf77c663 56a25a87d40ab25a1dd972a7d154f8a5 081420f230d5a85ab2b55453c43c7967 14
|
5
|
+
test 3361066b2c297543 787699fcb627774fcf0f0d82462d6e7d ceb8b4f88c02df34addaf431e7a7a07c 9
|
6
|
+
algorithm cipher diamond2_lite
|
7
|
+
test e834fdb933c502923d92bc9e14368e70d41c66cbdf36155033a66e07e6cc6d8d 5a8d872d31eedde6 2e69544d7723cba0 30
|
8
|
+
test 599b02fbd0d321a789eb97b388bf77c663 56a25a87d40ab25a 3177400de74099bb 11
|
9
|
+
test 3361066b2c297543 787699fcb627774f 06ad8cdf623d31f7 10
|
@@ -0,0 +1,10 @@
|
|
1
|
+
algorithm cipher gost
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test be5ec2006cff9dcf52354959f1ff0cbfe95061b5a648c10387069c25997c0672 0df82802b741a292 07f9027df7f7df89
|
4
|
+
test b385272ac8d72a5a8b344bc80363ac4d09bf58f41f540624cbcb8fdcf55307d7 1354ee9c0a11cd4c 4fb50536f960a7b1
|
5
|
+
test aee02f609a35660e4097e546fd3026b032cd107c7d459977adf489bef2652262 6693d492c4b0cc39 670034ac0fa811b5
|
6
|
+
test 320e9d8422165d58911dfc7d8bbb1f81b0ecd924023bf94d9df7dcf7801240e0 99e2d13080928d79 8118ff9d3b3cfe7d
|
7
|
+
test c9f703bbbfc63691bfa3b7b87ea8fd5e8e8ef384ef733f1a61aef68c8ffa265f d1e787749c72814c a083826a790d3e0c
|
8
|
+
test 728fee32f04b4c654ad7f607d71c660c2c2670d7c999713233149a1c0c17a1f0 d4c05323a4f7a7b5 4d1f2e6b0d9de2ce
|
9
|
+
test 35fc96402209500fcfdef5352d1abb038fe33fc0d9d58512e56370b22baa133b 8742d9a05f6a3af6 2f3bb84879d11e52
|
10
|
+
test d416f630be65b7fe150656183370e07018234ee5da3d89c4ce9152a03e5bfb77 f86506da04e41cb8 96f0a5c77a04f5ce
|
@@ -0,0 +1,13 @@
|
|
1
|
+
algorithm cipher idea
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 00010002000300040005000600070008 0000000100020003 11fbed2b01986de5
|
4
|
+
test 00010002000300040005000600070008 0102030405060708 540e5fea18c2f8b1
|
5
|
+
test 00010002000300040005000600070008 0019324b647d96af 9f0a0ab6e10ced78
|
6
|
+
test 00010002000300040005000600070008 f5202d5b9c671b08 cf18fd7355e2c5c5
|
7
|
+
test 00010002000300040005000600070008 fae6d2beaa96826e 85df52005608193d
|
8
|
+
test 00010002000300040005000600070008 0a141e28323c4650 2f7de750212fb734
|
9
|
+
test 00010002000300040005000600070008 050a0f14191e2328 7b7314925de59c09
|
10
|
+
test 0005000a000f00140019001e00230028 0102030405060708 3ec04780beff6e20
|
11
|
+
test 3a984e2000195db32ee501c8c47cea60 0102030405060708 97bcd8200780da86
|
12
|
+
test 006400c8012c019001f4025802bc0320 05320a6414c819fa 65be87e7a2538aed
|
13
|
+
test 9d4075c103bc322afb03e7be6ab30006 0808080808080808 f5db1ac45e5ef9f9
|
@@ -0,0 +1,11 @@
|
|
1
|
+
algorithm cipher mars
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 00000000000000000000000000000000 00000000000000000000000000000000 dcc07b8dfb0738d6e30a22dfcf27e886
|
4
|
+
test 00000000000000000000000000000000 dcc07b8dfb0738d6e30a22dfcf27e886 33caffbddc7f1dda0f9c15fa2f30e2ff
|
5
|
+
test cb14a1776abbc1cdafe7243def2cea02 f94512a9b42d034ec4792204d708a69b 225da2cb64b73f79069f21a5e3cb8522
|
6
|
+
test 86edf4da31824cabef6a4637c40b0bab 4df955ad5b398d66408d620a2b27e1a9 a4b737340ae6d2cafd930ba97d86129f
|
7
|
+
test 000000000000000000000000000000000000000000000000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 97778747d60e425c2b4202599db856fb
|
8
|
+
test d158860838874d9500000000000000000000000000000000 93a953a82c10411dd158860838874d95 4fa0e5f64893131712f01408d233e9f7
|
9
|
+
test 791739a58b04581a93a953a82c10411dd158860838874d95 6761c42d3e6142d2a84fbfadb383158f f706bc0fd97e28b6f1af4e17d8755fff
|
10
|
+
test 0000000000000000000000000000000000000000000000000000000000000000 62e45b4cf3477f1dd65063729d9aba8f 0f4b897ea014d21fbc20f1054a42f719
|
11
|
+
test fba167983e7aef22317ce28c02aae1a3e8e5cc3cedbea82a99dbc39ad65e7227 1344aba4d3c44708a8a72116d4f49384 458335d95ea42a9f4dccd41aecc2390d
|
@@ -0,0 +1,7 @@
|
|
1
|
+
algorithm cipher panama_le
|
2
|
+
fields key_hex plaintext_hex iv_hex ciphertext_hex
|
3
|
+
test 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f f07f5ff2ccd01a0a7d44acd6d239c2af0da1ff35275baf5dfa6e09411b79d8b9
|
4
|
+
|
5
|
+
algorithm cipher panama_be
|
6
|
+
fields key_hex plaintext_hex iv_hex ciphertext_hex
|
7
|
+
test 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f e12e2f6ba41ae832d888da9fa6863bc37c0e996f190a1711330322d37bd98ca4
|
@@ -0,0 +1,10 @@
|
|
1
|
+
algorithm cipher rc2
|
2
|
+
fields key_length effective_key_length key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 8 63 0000000000000000 0000000000000000 ebb773f993278eff
|
4
|
+
test 8 64 ffffffffffffffff ffffffffffffffff 278b27e42e2f0d49
|
5
|
+
test 8 64 3000000000000000 1000000000000001 30649edf9be7d2c2
|
6
|
+
test 1 64 88 0000000000000000 61a8a244adacccf0
|
7
|
+
test 7 64 88bca90e90875a 0000000000000000 6ccf4308974c267f
|
8
|
+
test 16 64 88bca90e90875a7f0f79c384627bafb2 0000000000000000 1a807d272bbe5db1
|
9
|
+
test 16 128 88bca90e90875a7f0f79c384627bafb2 0000000000000000 2269552ab0f85ca6
|
10
|
+
test 33 129 88bca90e90875a7f0f79c384627bafb216f80a6f85920584c42fceb0be255daf1e 0000000000000000 5b78d3a43dfff1f1
|
@@ -0,0 +1,7 @@
|
|
1
|
+
algorithm cipher rc5
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex rounds
|
3
|
+
test 00000000000000000000000000000000 0000000000000000 21a5dbee154b8f6d 12
|
4
|
+
test 915f4619be41b2516355a50110a9ce91 21a5dbee154b8f6d f7c013ac5b2b8952 12
|
5
|
+
test 783348e75aeb0f2fd7b169bb8dc16787 f7c013ac5b2b8952 2f42b3b70369fc92 12
|
6
|
+
test dc49db1375a5584f6485b413b5f12baf 2f42b3b70369fc92 65c178b284d197cc 12
|
7
|
+
test 5269f149d41ba0152497574d7f153125 65c178b284d197cc eb44e415da319824 12
|
@@ -0,0 +1,8 @@
|
|
1
|
+
algorithm cipher rc6
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 00000000000000000000000000000000 00000000000000000000000000000000 8fc3a53656b1f778c129df4e9848a41e
|
4
|
+
test 0123456789abcdef0112233445566778 02132435465768798a9bacbdcedfe0f1 524e192f4715c6231f51f6367ea43f18
|
5
|
+
test 000000000000000000000000000000000000000000000000 00000000000000000000000000000000 6cd61bcb190b30384e8a3f168690ae82
|
6
|
+
test 0123456789abcdef0112233445566778899aabbccddeeff0 02132435465768798a9bacbdcedfe0f1 688329d019e505041e52e92af95291d4
|
7
|
+
test 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000 8f5fbd0510d15fa893fa3fda6e857ec2
|
8
|
+
test 0123456789abcdef0112233445566778899aabbccddeeff01032547698badcfe 02132435465768798a9bacbdcedfe0f1 c8241816f0d7e48920ad16a1674e5d48
|
@@ -0,0 +1,11 @@
|
|
1
|
+
algorithm cipher aes
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 000102030405060708090a0b0c0d0e0f 000102030405060708090a0b0c0d0e0f 0a940bb5416ef045f1c39458c653ea5a
|
4
|
+
test 00010203050607080a0b0c0d0f101112 506812a45f08c889b97f5980038b8359 d8f532538289ef7d06b506a4fd5be9c9
|
5
|
+
test 14151617191a1b1c1e1f202123242526 5c6d71ca30de8b8b00549984d2ec7d4b 59ab30f4d4ee6e4ff9907ef65b1fb68c
|
6
|
+
test 28292a2b2d2e2f30323334353738393a 53f3f4c64f8616e4e7c56199f48f21f6 bf1ed2fcb2af3fd41443b56d85025cb1
|
7
|
+
test 00010203050607080a0b0c0d0f10111214151617191a1b1c 2d33eef2c0430a8a9ebf45e809c40bb6 dff4945e0336df4c1c56bc700eff837f
|
8
|
+
test 1e1f20212324252628292a2b2d2e2f30323334353738393a 6aa375d1fa155a61fb72353e0a5a8756 b6fddef4752765e347d5d2dc196d1252
|
9
|
+
test 3c3d3e3f41424344464748494b4c4d4e5051525355565758 bc3736518b9490dcb8ed60eb26758ed4 d23684e3d963b3afcf1a114aca90cbd6
|
10
|
+
test 00010203050607080a0b0c0d0f10111214151617191a1b1c1e1f202123242526 834eadfccac7e1b30664b1aba44815ab 1946dabf6a03a2a2c3d0b05080aed6fc
|
11
|
+
test 28292a2b2d2e2f30323334353738393a3c3d3e3f41424344464748494b4c4d4e d9dc4dba3021b05d67c0518f72b62bf1 5ed301d747d3cc715445ebdec62f2fb4
|
@@ -0,0 +1,27 @@
|
|
1
|
+
algorithm cipher safer_k
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 0000000000000000 0000000000000000 032808c90ee7ab7f
|
4
|
+
test 0000000000000000 0102030405060708 7d28038633b92eb4
|
5
|
+
test 0102030405060708 1011121314151617 71e5cf7f083a59c5
|
6
|
+
test 0102030405060708 18191a1b1c1d1e1f 356f702cc7fa8161
|
7
|
+
|
8
|
+
algorithm cipher safer_k
|
9
|
+
fields key_hex plaintext_hex ciphertext_hex rounds
|
10
|
+
test 08070605040302010807060504030201 5051525354555657 38e64dbf6e0f896e 12
|
11
|
+
test 08070605040302010807060504030201 58595a5b5c5d5e5f 7d8f014a902480fe 12
|
12
|
+
test 01020304050607080807060504030201 6061626364656667 113511c22e7936df 12
|
13
|
+
test 01020304050607080807060504030201 68696a6b6c6d6e6f 9eeb2d17c0581437 12
|
14
|
+
|
15
|
+
algorithm cipher safer_sk
|
16
|
+
fields key_hex plaintext_hex ciphertext_hex rounds
|
17
|
+
test 0000000000000001 7071727374757677 9abe2c85be2d7614 6
|
18
|
+
test 0000000000000001 78797a7b7c7d7e7f ebc4a9c6c25cf215 6
|
19
|
+
test 0102030405060708 8081828384858687 54e72ba2d744c566 6
|
20
|
+
test 0102030405060708 88898a8b8c8d8e8f 57f55d0f7eb6f8fe 6
|
21
|
+
|
22
|
+
algorithm cipher safer_sk
|
23
|
+
fields key_hex plaintext_hex ciphertext_hex rounds
|
24
|
+
test 00000000000000010000000000000001 9091929394959697 9eaa4df1e0eff445 10
|
25
|
+
test 00000000000000010000000000000001 98999a9b9c9d9e9f 4cc14838399e532d 10
|
26
|
+
test 01020304050607080000000000000000 a0a1a2a3a4a5a6a7 41246b65f1dc6afa 10
|
27
|
+
test 00000000000000000102030405060708 a0a1a2a3a4a5a6a7 5cbd77b03626fe3b 10
|
@@ -0,0 +1,11 @@
|
|
1
|
+
algorithm cipher serpent
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 00000000000000000000000000000000 d29d576fcea3a3a7ed9099f29273d78e b2288b968ae8b08648d1ce9606fd992d
|
4
|
+
test 00000000000000000000000000000000 d29d576fcea3a3a7ed9099f26d8c2871 563a8403ff5309d62370b1dcf5a11edd
|
5
|
+
test ffeeddccbbaa99887766554433221100 1032547698badcfeefcdab8967452301 d5baa00a4bb9d8a7c981c8dc90d89d92
|
6
|
+
test ffeeddccbbaa99887766554433221100 145f0b8b663176b95dcab7e9dcd5cc24 1032547698badcfeefcdab8967452301
|
7
|
+
test 000000000000000000000000000000000000000000000000 d29d576fceaba3a7ed9899f2927bd78e 130e353e1037c22405e8faefb2c3c3e9
|
8
|
+
test 8899aabbccddeeffffeeddccbbaa99887766554433221100 1032547698badcfeefcdab8967452301 da860842b720802bf404a4c71034879a
|
9
|
+
test 8899aabbccddeeffffeeddccbbaa99887766554433221100 b2696bd0d98c17953e4239225d27202c 1032547698badcfeefcdab8967452301
|
10
|
+
test 0000000000000000000000000000000000000000000000000000000000000000 92074732d84e1841a013a0034c52bf50 81c4eb7b8ad9a8d0f2aa5d7bd626b560
|
11
|
+
test 00112233445566778899aabbccddeeffffeeddccbbaa99887766554433221100 1032547698badcfeefcdab8967452301 93df9a3cafe387bd999eebe393a17fca
|
@@ -0,0 +1,7 @@
|
|
1
|
+
algorithm cipher shacal2
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 361ab6322fa9e7a7bb23818d839e01bddafdf47305426edd297aedb9f6202bae
|
4
|
+
test 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 8000000000000000000000000000000000000000000000000000000000000000 2cae7c0460ee2fc3200923a1b6c2abeea746c8b44f6c3fb941bd3af02a3e6e3e
|
5
|
+
test 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 7ca51614425c3ba8ce54dd2fc2020ae7b6e574d198136d0fae7e26ccbf0be7a6
|
6
|
+
test 24242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424 2424242424242424242424242424242424242424242424242424242424242424 9766d3f9e73987ee10a20605c8338c0759a7024cf2df549de5084ec4902c550a
|
7
|
+
test fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe fefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefe 5dc15c83e7c4f5aaf8d8482ed1e443271b28b59288783dbcddec3544e3368a6e
|
@@ -0,0 +1,9 @@
|
|
1
|
+
algorithm cipher shark
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 00000000000000000000000000000000 0000000000000000 214bcf4e7716420a
|
4
|
+
test 000102030405060708090a0b0c0d0e0f 0000000000000000 c76c696289898137
|
5
|
+
test 000102030405060708090a0b0c0d0e0f c76c696289898137 077a4a59faeeea4d
|
6
|
+
test 915f4619be41b2516355a50110a9ce91 21a5dbee154b8f6d 6ff33b98f448e95a
|
7
|
+
test 783348e75aeb0f2fd7b169bb8dc16787 f7c013ac5b2b8952 e5e554abe9ced2d2
|
8
|
+
test dc49db1375a5584f6485b413b5f12baf 2f42b3b70369fc92 9ae068313f343a7a
|
9
|
+
test 5269f149d41ba0152497574d7f153125 65c178b284d197cc d3f111a282f17f29
|
@@ -0,0 +1,10 @@
|
|
1
|
+
algorithm cipher square
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 00000000000000000000000000000000 00000000000000000000000000000000 3c00428f8abbc0b84f057cc19c26f8cf
|
4
|
+
test 000102030405060708090a0b0c0d0e0f 00000000000000000000000000000000 ff596fa668bfc3014200ae01e2bba0a0
|
5
|
+
test 000102030405060708090a0b0c0d0e0f 000102030405060708090a0b0c0d0e0f 7c3491d94994e70f0ec2e7a5ccb5a14f
|
6
|
+
test 000102030405060708090a0b0c0d0e0f c76c696289898137077a4a59faeeea4d 88c6ff4b92604c6e66656b02ddaf9f40
|
7
|
+
test 915f4619be41b2516355a50110a9ce91 21a5dbee154b8f6d6ff33b98f448e95a 3388801f66e7fcc0bce522a23a4f0c7f
|
8
|
+
test 783348e75aeb0f2fd7b169bb8dc16787 f7c013ac5b2b8952e5e554abe9ced2d2 a1c0e9215141343dec2b556942c92bde
|
9
|
+
test dc49db1375a5584f6485b413b5f12baf 2f42b3b70369fc929ae068313f343a7a 3fbe6811b998cdf3e50abde2f3c075e3
|
10
|
+
test 5269f149d41ba0152497574d7f153125 65c178b284d197ccd3f111a282f17f29 d7b7209e0879744c782809b6d2e0b1b0
|
@@ -0,0 +1,11 @@
|
|
1
|
+
algorithm cipher twofish
|
2
|
+
fields key_hex plaintext_hex ciphertext_hex
|
3
|
+
test 00000000000000000000000000000000 00000000000000000000000000000000 9f589f5cf6122c32b6bfec2f2ae8c35a
|
4
|
+
test 00000000000000000000000000000000 9f589f5cf6122c32b6bfec2f2ae8c35a d491db16e7b1c39e86cb086b789f5419
|
5
|
+
test 9f589f5cf6122c32b6bfec2f2ae8c35a d491db16e7b1c39e86cb086b789f5419 019f9809de1711858faac3a3ba20fbc3
|
6
|
+
test d491db16e7b1c39e86cb086b789f5419 019f9809de1711858faac3a3ba20fbc3 6363977de839486297e661c6c9d668eb
|
7
|
+
test 000000000000000000000000000000000000000000000000 00000000000000000000000000000000 efa71f788965bd4453f860178fc19101
|
8
|
+
test efa71f788965bd4453f860178fc191010000000000000000 88b2b2706b105e36b446bb6d731a1e88 39da69d6ba4997d585b6dc073ca341b2
|
9
|
+
test 88b2b2706b105e36b446bb6d731a1e88efa71f788965bd44 39da69d6ba4997d585b6dc073ca341b2 182b02d81497ea45f9daacdc29193a65
|
10
|
+
test 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000 57ff739d4dc92c1bd7fc01700cc8216f
|
11
|
+
test d43bb7556ea32e46f2a282b7d45b4e0d57ff739d4dc92c1bd7fc01700cc8216f 90afe91bb288544f2c32dc239b2635e6 6cb4561c40bf0a9705931cb6d408e7fa
|
@@ -0,0 +1,10 @@
|
|
1
|
+
algorithm checksum crc32
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test 00000000
|
4
|
+
test a 43beb7e8
|
5
|
+
test abc c2412435
|
6
|
+
test message digest 7f9d1520
|
7
|
+
test abcdefghijklmnopqrstuvwxyz bd50274c
|
8
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 d2e6c21f
|
9
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 724aa97c
|
10
|
+
test 123456789 2639f4cb
|
@@ -0,0 +1,4 @@
|
|
1
|
+
algorithm digest haval5
|
2
|
+
fields plaintext digest
|
3
|
+
test abcdefghijklmnopqrstuvwxyz c9c7d8afa159fd9e965cb83ff5ee6f58aeda352c0eff005548153a61551c38ee
|
4
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 b45cb6e62f2b1320e4f8f1b0b273d45add47c321fd23999dcf403ac37636d963
|
@@ -0,0 +1,23 @@
|
|
1
|
+
3 128
|
2
|
+
|
3
|
+
1BDC556B29AD02EC09AF8C66477F2A87
|
4
|
+
|
5
|
+
3 160
|
6
|
+
a
|
7
|
+
5E1610FCED1D3ADB0BB18E92AC2B11F0BD99D8ED
|
8
|
+
|
9
|
+
4 192
|
10
|
+
HAVAL
|
11
|
+
74AA31182FF09BCCE453A7F71B5A7C5E80872FA90CD93AE4
|
12
|
+
|
13
|
+
4 224
|
14
|
+
0123456789
|
15
|
+
144CB2DE11F05DF7C356282A3B485796DA653F6B702868C7DCF4AE76
|
16
|
+
|
17
|
+
5 256
|
18
|
+
abcdefghijklmnopqrstuvwxyz
|
19
|
+
1A1DC8099BDAA7F35B4DA4E805F1A28FEE909D8DEE920198185CBCAED8A10A8D
|
20
|
+
|
21
|
+
5 256
|
22
|
+
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
23
|
+
C5647FC6C1877FFF96742F27E9266B6874894F41A08F5913033D9D532AEDDB39
|
@@ -0,0 +1,9 @@
|
|
1
|
+
algorithm digest md2
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test 8350e5a3e24c153df2275c9f80692773
|
4
|
+
test a 32ec01ec4a6dac72c0ab96fb34c0b5d1
|
5
|
+
test abc da853b0d3f88d99b30283a69e6ded6bb
|
6
|
+
test message digest ab4f496bfb2a530b219ff33031fe06b0
|
7
|
+
test abcdefghijklmnopqrstuvwxyz 4e8ddff3650292ab5a4108c3aa47940b
|
8
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 da33def2a42df13975352846c30338cd
|
9
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 d5976f79d83d3a0dc9806c3c66f3efd8
|
@@ -0,0 +1,9 @@
|
|
1
|
+
algorithm digest md4
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test 31d6cfe0d16ae931b73c59d7e0c089c0
|
4
|
+
test a bde52cb31de33e46245e05fbdbd6fb24
|
5
|
+
test abc a448017aaf21d8525fc10ae87aa6729d
|
6
|
+
test message digest d9130a8164549fe818874806e1c7014b
|
7
|
+
test abcdefghijklmnopqrstuvwxyz d79e1c308aa5bbcdeea8ed63df412da9
|
8
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 043f8582f241db351ce627e153e7f0e4
|
9
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 e33b4ddc9c38f2199c3e7b164fcc0536
|
@@ -0,0 +1,9 @@
|
|
1
|
+
algorithm digest md5
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test d41d8cd98f00b204e9800998ecf8427e
|
4
|
+
test a 0cc175b9c0f1b6a831c399e269772661
|
5
|
+
test abc 900150983cd24fb0d6963f7d28e17f72
|
6
|
+
test message digest f96b697d7cb7938d525a2f31aaf161d0
|
7
|
+
test abcdefghijklmnopqrstuvwxyz c3fcd3d76192e4007dfb496cca67e13b
|
8
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 d174ab98d277d9f5a5611c2c9f419d9f
|
9
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 57edf4a22be3c955ac49da2e2107b67a
|
@@ -0,0 +1,8 @@
|
|
1
|
+
algorithm digest panama_le
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test aa0cc954d757d7ac7779ca3342334ca471abd47d5952ac91ed837ecd5b16922b
|
4
|
+
test The quick brown fox jumps over the lazy dog 5f5ca355b90ac622b0aa7e654ef5f27e9e75111415b48b8afe3add1c6b89cba1
|
5
|
+
algorithm digest panama_be
|
6
|
+
fields plaintext digest_hex
|
7
|
+
test e81aa04523532dd7267e5c5bc3ba0e289837a62ba032350351980e960a84b0af
|
8
|
+
test The quick brown fox jumps over the lazy dog 8fa7dadce0110f979a0b795e76b2c25628d8bda88747758149c42e3bc13f85bc
|
@@ -0,0 +1,43 @@
|
|
1
|
+
algorithm digest ripemd128
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test cdf26213a150dc3ecb610f18f6b38b46
|
4
|
+
test a 86be7afa339d0fc7cfc785e72f578d33
|
5
|
+
test abc c14a12199c66e4ba84636b0f69144c77
|
6
|
+
test message digest 9e327b3d6e523062afc1132d7df9d1b8
|
7
|
+
test abcdefghijklmnopqrstuvwxyz fd2aa607f71dc8f510714922b371834e
|
8
|
+
test abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq a1aa0689d0fafa2ddc22e88b49133a06
|
9
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 d1e959eb179c911faea4624c60c5c702
|
10
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 3f45ef194732c2dbb2c4a2c769795fa3
|
11
|
+
|
12
|
+
algorithm digest ripemd160
|
13
|
+
fields plaintext digest_hex
|
14
|
+
test 9c1185a5c5e9fc54612808977ee8f548b2258d31
|
15
|
+
test a 0bdc9d2d256b3ee9daae347be6f4dc835a467ffe
|
16
|
+
test abc 8eb208f7e05d987a9b044a8e98c6b087f15a0bfc
|
17
|
+
test message digest 5d0689ef49d2fae572b881b123a85ffa21595f36
|
18
|
+
test abcdefghijklmnopqrstuvwxyz f71c27109c692c1b56bbdceb5b9d2865b3708dbc
|
19
|
+
test abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq 12a053384a9c0c88e405a06c27dcf49ada62eb2b
|
20
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 b0e20b6e3116640286ed3a87a5713079b21f5189
|
21
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 9b752e45573d4b39f4dbd3323cab82bf63326bfb
|
22
|
+
|
23
|
+
algorithm digest ripemd256
|
24
|
+
fields plaintext digest_hex
|
25
|
+
test 02ba4c4e5f8ecd1877fc52d64d30e37a2d9774fb1e5d026380ae0168e3c5522d
|
26
|
+
test a f9333e45d857f5d90a91bab70a1eba0cfb1be4b0783c9acfcd883a9134692925
|
27
|
+
test abc afbd6e228b9d8cbbcef5ca2d03e6dba10ac0bc7dcbe4680e1e42d2e975459b65
|
28
|
+
test message digest 87e971759a1ce47a514d5c914c392c9018c7c46bc14465554afcdf54a5070c0e
|
29
|
+
test abcdefghijklmnopqrstuvwxyz 649d3034751ea216776bf9a18acc81bc7896118a5197968782dd1fd97d8d5133
|
30
|
+
test abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq 3843045583aac6c8c8d9128573e7a9809afb2a0f34ccc36ea9e72f16f6368e3f
|
31
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 5740a408ac16b720b84424ae931cbb1fe363d1d0bf4017f1a89f7ea6de77a0b8
|
32
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 06fdcc7a409548aaf91368c06a6275b553e3f099bf0ea4edfd6778df89a890dd
|
33
|
+
|
34
|
+
algorithm digest ripemd320
|
35
|
+
fields plaintext digest_hex
|
36
|
+
test 22d65d5661536cdc75c1fdf5c6de7b41b9f27325ebc61e8557177d705a0ec880151c3a32a00899b8
|
37
|
+
test a ce78850638f92658a5a585097579926dda667a5716562cfcf6fbe77f63542f99b04705d6970dff5d
|
38
|
+
test abc de4c01b3054f8930a79d09ae738e92301e5a17085beffdc1b8d116713e74f82fa942d64cdbc4682d
|
39
|
+
test message digest 3a8e28502ed45d422f68844f9dd316e7b98533fa3f2a91d29f84d425c88d6b4eff727df66a7c0197
|
40
|
+
test abcdefghijklmnopqrstuvwxyz cabdb1810b92470a2093aa6bce05952c28348cf43ff60841975166bb40ed234004b8824463e6b009
|
41
|
+
test abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq d034a7950cf722021ba4b84df769a5de2060e259df4c9bb4a4268c0e935bbc7470a969c9d072a1ac
|
42
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 ed544940c86d67f250d232c30b7b3e5770e0c60c8cb9a4cafe3b11388af9920e1b99230b843c86a4
|
43
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 557888af5f6d8ed62ab66945c6d2a0a47ecd5341e915eb8fea1d0524955f825dc717e4a008ab2d42
|
@@ -0,0 +1,19 @@
|
|
1
|
+
algorithm digest sha1
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test abc a9993e364706816aba3e25717850c26c9cd0d89d
|
4
|
+
test abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq 84983e441c3bd26ebaae4aa1f95129e5e54670f1
|
5
|
+
|
6
|
+
algorithm digest sha256
|
7
|
+
fields plaintext digest_hex
|
8
|
+
test abc ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
|
9
|
+
test abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1
|
10
|
+
|
11
|
+
algorithm digest sha384
|
12
|
+
fields plaintext digest_hex
|
13
|
+
test abc cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7
|
14
|
+
test abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu 09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039
|
15
|
+
|
16
|
+
algorithm digest sha512
|
17
|
+
fields plaintext digest_hex
|
18
|
+
test abc ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f
|
19
|
+
test abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu 8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909
|
@@ -0,0 +1,11 @@
|
|
1
|
+
algorithm digest tiger
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test 3293ac630c13f0245f92bbb1766e16167a4e58492dde73f3
|
4
|
+
test abc 2aab1484e8c158f2bfb8c5ff41b57a525129131c957b5f93
|
5
|
+
test Tiger dd00230799f5009fec6debc838bb6a27df2b9d6f110c7937
|
6
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+- f71c8583902afb879edfe610f82c0d4786a3a534504486b5
|
7
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789 48ceeb6308b87d46e95d656112cdf18d97915f9765658957
|
8
|
+
test Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham 8a866829040a410c729ad23f5ada711603b3cdd357e4c15e
|
9
|
+
test Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge. ce55a6afd591f5ebac547ff84f89227f9331dab0b611c889
|
10
|
+
test Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham, proceedings of Fast Software Encryption 3, Cambridge, 1996. 631abdd103eb9a3d245b6dfd4d77b257fc7439501d1568dd
|
11
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+- c54034e5b43eb8005848a7e0ae6aac76e4ff590ae715fd25
|
@@ -0,0 +1,13 @@
|
|
1
|
+
algorithm digest whirlpool
|
2
|
+
fields plaintext digest_hex
|
3
|
+
test 19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3
|
4
|
+
test a 8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a
|
5
|
+
test abc 4e2448a4c6f486bb16b6562c73b4020bf3043e3a731bce721ae1b303d97e6d4c7181eebdb6c57e277d0e34957114cbd6c797fc9d95d8b582d225292076d4eef5
|
6
|
+
test message digest 378c84a4126e2dc6e56dcc7458377aac838d00032230f53ce1f5700c0ffb4d3b8421557659ef55c106b4b52ac5a4aaa692ed920052838f3362e86dbd37a8903e
|
7
|
+
test abcdefghijklmnopqrstuvwxyz f1d754662636ffe92c82ebb9212a484a8d38631ead4238f5442ee13b8054e41b08bf2a9251c30b6a0b8aae86177ab4a6f68f673e7207865d5d9819a3dba4eb3b
|
8
|
+
test ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 dc37e008cf9ee69bf11f00ed9aba26901dd7c28cdec066cc6af42e40f82f3a1e08eba26629129d8fb7cb57211b9281a65517cc879d7b962142c65f5a7af01467
|
9
|
+
test 12345678901234567890123456789012345678901234567890123456789012345678901234567890 466ef18babb0154d25b9d38a6414f5c08784372bccb204d6549c4afadb6014294d5bd8df2a6c44e538cd047b2681a51a2c60481e88c5a20b2c2a80cf3a9a083b
|
10
|
+
test abcdbcdecdefdefgefghfghighijhijk 2a987ea40f917061f5d6f0a0e4644f488a7a5a52deee656207c562f988e95c6916bdc8031bc5be1b7b947639fe050b56939baaa0adff9ae6745b7b181c3be3fd
|
11
|
+
#Message: r1000000 "a"
|
12
|
+
#Digest: 0C99005BEB57EFF5 0A7CF005560DDF5D 29057FD86B20BFD6 2DECA0F1CCEA4AF5\
|
13
|
+
# 1FC15490EDDC47AF 32BB2B66C34FF9AD 8C6008AD677F7712 6953B226E4ED8B01
|
@@ -0,0 +1,6 @@
|
|
1
|
+
algorithm hmac MD5
|
2
|
+
fields plaintext key_hex digest_hex
|
3
|
+
test Hi There 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b 9294727a3638bb1c13f48ef8158bfc9d
|
4
|
+
test what do ya want for nothing? 4A656665 750c783e6ab0b503eaa86e310a5db738
|
5
|
+
fields plaintext key_hex key_repeat digest_hex
|
6
|
+
test Test Using Larger Than Block-Size Key - Hash Key First A 160 6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'test/test_helper'
|
4
|
+
|
5
|
+
class DigestsTest < Test::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
Dir.glob('test/data/digests/*.dat').sort.each do |f|
|
9
|
+
test_name = File.basename(f).gsub(/.dat$/, '')
|
10
|
+
|
11
|
+
class_eval(%{
|
12
|
+
def test_#{test_name}
|
13
|
+
run_digest_test("#{f}")
|
14
|
+
end
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
def run_digest_test(file)
|
19
|
+
readfile(file) do |options|
|
20
|
+
if CryptoPP.digest_enabled? options[:algorithm]
|
21
|
+
d = CryptoPP.digest_factory(options[:algorithm], options[:plaintext])
|
22
|
+
t = CryptoPP.digest_factory(options[:algorithm], { :digest => d.digest, :plaintext => d.plaintext })
|
23
|
+
|
24
|
+
assert(t.validate)
|
25
|
+
assert_equal(d.digest_hex, options[:digest_hex])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/test/hmacs_test.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'test/test_helper'
|
4
|
+
|
5
|
+
class HMACsTest < Test::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
Dir.glob('test/data/hmacs/*.dat').sort.each do |f|
|
9
|
+
test_name = File.basename(f).gsub(/.dat$/, '')
|
10
|
+
|
11
|
+
class_eval(%{
|
12
|
+
def test_#{test_name}
|
13
|
+
run_digest_test("#{f}")
|
14
|
+
end
|
15
|
+
})
|
16
|
+
end
|
17
|
+
|
18
|
+
def run_digest_test(file)
|
19
|
+
readfile(file) do |options|
|
20
|
+
if CryptoPP.digest_enabled? options[:algorithm]
|
21
|
+
d = CryptoPP.hmac_factory(options[:algorithm], {
|
22
|
+
:key_hex => options[:key_hex],
|
23
|
+
:plaintext => options[:plaintext]
|
24
|
+
})
|
25
|
+
d.calculate
|
26
|
+
|
27
|
+
t = CryptoPP.hmac_factory(options[:algorithm], {
|
28
|
+
:digest => d.digest,
|
29
|
+
:plaintext => d.plaintext,
|
30
|
+
:key => d.key
|
31
|
+
})
|
32
|
+
|
33
|
+
assert(t.validate)
|
34
|
+
assert_equal(d.digest_hex, options[:digest_hex])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|