ruby-aes-cext 1.0-i686-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/COPYING +20 -0
- data/README +77 -0
- data/Rakefile +154 -0
- data/examples/encrypt_block.rb +22 -0
- data/examples/encrypt_buffer.rb +24 -0
- data/examples/encrypt_stream.rb +39 -0
- data/examples/example_helper.rb +27 -0
- data/ext/ruby-aes/aes_alg.so +0 -0
- data/lib/ruby-aes.rb +162 -0
- data/test/KAT_MCT/aes_kat_mct.rb +386 -0
- data/test/KAT_MCT/rijndael-vals.zip +0 -0
- data/test/KAT_MCT/table.128 +128 -0
- data/test/KAT_MCT/table.192 +128 -0
- data/test/KAT_MCT/table.256 +128 -0
- data/test/test_helper.rb +14 -0
- data/test/test_ruby-aes.rb +113 -0
- metadata +78 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526 83 4e ad fc ca c7 e1 b3 06 64 b1 ab a4 48 15 ab
|
2
|
+
28292A2B2D2E2F30323334353738393A3C3D3E3F41424344464748494B4C4D4E d9 dc 4d ba 30 21 b0 5d 67 c0 51 8f 72 b6 2b f1
|
3
|
+
50515253555657585A5B5C5D5F60616264656667696A6B6C6E6F707173747576 a2 91 d8 63 01 a4 a7 39 f7 39 21 73 aa 3c 60 4c
|
4
|
+
78797A7B7D7E7F80828384858788898A8C8D8E8F91929394969798999B9C9D9E 42 64 b2 69 64 98 de 4d f7 97 88 a9 f8 3e 93 90
|
5
|
+
A0A1A2A3A5A6A7A8AAABACADAFB0B1B2B4B5B6B7B9BABBBCBEBFC0C1C3C4C5C6 ee 99 32 b3 72 18 04 d5 a8 3e f5 94 92 45 b6 f6
|
6
|
+
C8C9CACBCDCECFD0D2D3D4D5D7D8D9DADCDDDEDFE1E2E3E4E6E7E8E9EBECEDEE e6 24 8f 55 c5 fd cb ca 9c bb b0 1c 88 a2 ea 77
|
7
|
+
F0F1F2F3F5F6F7F8FAFBFCFDFE01000204050607090A0B0C0E0F101113141516 b8 35 8e 41 b9 df f6 5f d4 61 d5 5a 99 26 62 47
|
8
|
+
18191A1B1D1E1F20222324252728292A2C2D2E2F31323334363738393B3C3D3E f0 e2 d7 22 60 af 58 e2 1e 01 5a b3 a4 c0 d9 06
|
9
|
+
40414243454647484A4B4C4D4F50515254555657595A5B5C5E5F606163646566 47 5b 8b 82 3c e8 89 3d b3 c4 4a 9f 2a 37 9f f7
|
10
|
+
68696A6B6D6E6F70727374757778797A7C7D7E7F81828384868788898B8C8D8E 68 8f 52 81 94 58 12 86 2f 5f 30 76 cf 80 41 2f
|
11
|
+
90919293959697989A9B9C9D9FA0A1A2A4A5A6A7A9AAABACAEAFB0B1B3B4B5B6 08 d1 d2 bc 75 0a f5 53 36 5d 35 e7 5a fa ce aa
|
12
|
+
B8B9BABBBDBEBFC0C2C3C4C5C7C8C9CACCCDCECFD1D2D3D4D6D7D8D9DBDCDDDE 87 07 12 1f 47 cc 3e fc ec a5 f9 a8 47 49 50 a1
|
13
|
+
E0E1E2E3E5E6E7E8EAEBECEDEFF0F1F2F4F5F6F7F9FAFBFCFEFE010103040506 e5 1a a0 b1 35 db a5 66 93 9c 3b 63 59 a9 80 c5
|
14
|
+
08090A0B0D0E0F10121314151718191A1C1D1E1F21222324262728292B2C2D2E 06 9a 00 7f c7 6a 45 9f 98 ba f9 17 fe df 95 21
|
15
|
+
30313233353637383A3B3C3D3F40414244454647494A4B4C4E4F505153545556 72 61 65 c1 72 3f bc f6 c0 26 d7 d0 0b 09 10 27
|
16
|
+
58595A5B5D5E5F60626364656768696A6C6D6E6F71727374767778797B7C7D7E d7 c5 44 de 91 d5 5c fc de 1f 84 ca 38 22 00 ce
|
17
|
+
80818283858687888A8B8C8D8F90919294959697999A9B9C9E9FA0A1A3A4A5A6 fe d3 c9 a1 61 b9 b5 b2 bd 61 1b 41 dc 9d a3 57
|
18
|
+
A8A9AAABADAEAFB0B2B3B4B5B7B8B9BABCBDBEBFC1C2C3C4C6C7C8C9CBCCCDCE 4f 63 4c dc 65 51 04 34 09 f3 0b 63 58 32 cf 82
|
19
|
+
D0D1D2D3D5D6D7D8DADBDCDDDFE0E1E2E4E5E6E7E9EAEBECEEEFF0F1F3F4F5F6 10 9c e9 8d b0 df b3 67 34 d9 f3 39 47 11 b4 e6
|
20
|
+
70717273757677787A7B7C7D7F80818284858687898A8B8C8E8F909193949596 4e a6 df ab a2 d8 a0 2f fd ff a8 98 35 98 72 42
|
21
|
+
98999A9B9D9E9FA0A2A3A4A5A7A8A9AAACADAEAFB1B2B3B4B6B7B8B9BBBCBDBE 5a e0 94 f5 4a f5 8e 6e 3c db f9 76 da c6 d9 ef
|
22
|
+
C0C1C2C3C5C6C7C8CACBCCCDCFD0D1D2D4D5D6D7D9DADBDCDEDFE0E1E3E4E5E6 76 4d 8e 8e 0f 29 92 6d be 51 22 e6 63 54 fd be
|
23
|
+
E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FAFCFDFEFF01020304060708090B0C0D0E 3f 04 18 f8 88 cd f2 9a 98 2b f6 b7 54 10 d6 a9
|
24
|
+
10111213151617181A1B1C1D1F20212224252627292A2B2C2E2F303133343536 e4 a3 e7 cb 12 cd d5 6a a4 a7 51 97 a9 53 02 20
|
25
|
+
38393A3B3D3E3F40424344454748494A4C4D4E4F51525354565758595B5C5D5E 21 16 77 68 4a ac 1e c1 a1 60 f4 4c 4e bf 3f 26
|
26
|
+
60616263656667686A6B6C6D6F70717274757677797A7B7C7E7F808183848586 d2 1e 43 9f f7 49 ac 8f 18 d6 d4 b1 05 e0 38 95
|
27
|
+
88898A8B8D8E8F90929394959798999A9C9D9E9FA1A2A3A4A6A7A8A9ABACADAE d9 f6 ff 44 64 6c 47 25 bd 4c 01 03 ff 55 52 a7
|
28
|
+
B0B1B2B3B5B6B7B8BABBBCBDBFC0C1C2C4C5C6C7C9CACBCCCECFD0D1D3D4D5D6 0b 12 56 c2 a0 0b 97 62 50 cf c5 b0 c3 7e d3 82
|
29
|
+
D8D9DADBDDDEDFE0E2E3E4E5E7E8E9EAECEDEEEFF1F2F3F4F6F7F8F9FBFCFDFE b0 56 44 7f fc 6d c4 52 3a 36 cc 2e 97 2a 3a 79
|
30
|
+
00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526 5e 25 ca 78 f0 de 55 80 25 24 d3 8d a3 fe 44 56
|
31
|
+
28292A2B2D2E2F30323334353738393A3C3D3E3F41424344464748494B4C4D4E a5 bc f4 72 8f a5 ea ad 85 67 c0 dc 24 67 5f 83
|
32
|
+
50515253555657585A5B5C5D5F60616264656667696A6B6C6E6F707173747576 81 4e 59 f9 7e d8 46 46 b7 8b 2c a0 22 e9 ca 43
|
33
|
+
78797A7B7D7E7F80828384858788898A8C8D8E8F91929394969798999B9C9D9E 15 47 8b ee c5 8f 47 75 c7 a7 f5 d4 39 55 14 d7
|
34
|
+
A0A1A2A3A5A6A7A8AAABACADAFB0B1B2B4B5B6B7B9BABBBCBEBFC0C1C3C4C5C6 25 35 48 ff ca 46 1c 67 c8 cb c7 8c d5 9f 47 56
|
35
|
+
C8C9CACBCDCECFD0D2D3D4D5D7D8D9DADCDDDEDFE1E2E3E4E6E7E8E9EBECEDEE fd 7a d8 d7 3b 9b 0f 8c c4 16 00 64 0f 50 3d 65
|
36
|
+
F0F1F2F3F5F6F7F8FAFBFCFDFE01000204050607090A0B0C0E0F101113141516 06 19 9d e5 2c 6c bf 8a f9 54 cd 65 83 0b cd 56
|
37
|
+
18191A1B1D1E1F20222324252728292A2C2D2E2F31323334363738393B3C3D3E f1 7c 4f fe 48 e4 4c 61 bd 89 1e 25 7e 72 57 94
|
38
|
+
40414243454647484A4B4C4D4F50515254555657595A5B5C5E5F606163646566 9a 5b 4a 40 2a 3e 8a 59 be 6b f5 cd 81 54 f0 29
|
39
|
+
68696A6B6D6E6F70727374757778797A7C7D7E7F81828384868788898B8C8D8E 79 bd 40 b9 1a 7e 07 dc 93 9d 44 17 82 ae 6b 17
|
40
|
+
90919293959697989A9B9C9D9FA0A1A2A4A5A6A7A9AAABACAEAFB0B1B3B4B5B6 d8 ce aa f8 97 6e 5f be 10 12 d8 c8 4f 32 37 99
|
41
|
+
B8B9BABBBDBEBFC0C2C3C4C5C7C8C9CACCCDCECFD1D2D3D4D6D7D8D9DBDCDDDE 33 16 e2 75 1e 2e 38 8b 08 3d a2 3d d6 ac 3f be
|
42
|
+
E0E1E2E3E5E6E7E8EAEBECEDEFF0F1F2F4F5F6F7F9FAFBFCFEFE010103040506 8b 7c fb e3 7d e7 dc a7 93 52 18 19 24 2c 58 16
|
43
|
+
08090A0B0D0E0F10121314151718191A1C1D1E1F21222324262728292B2C2D2E f2 3f 03 3c 0e eb f8 ec 55 75 26 62 fd 58 ce 68
|
44
|
+
30313233353637383A3B3C3D3F40414244454647494A4B4C4E4F505153545556 59 eb 34 f6 c8 bd ba cc 5f c6 ad 73 a5 9a 13 01
|
45
|
+
58595A5B5D5E5F60626364656768696A6C6D6E6F71727374767778797B7C7D7E dc de 8b 6b d5 cf 7c c2 2d 95 05 e3 ce 81 26 1a
|
46
|
+
80818283858687888A8B8C8D8F90919294959697999A9B9C9E9FA0A1A3A4A5A6 e3 3c f7 e5 24 fe d7 81 e7 04 2f f9 f4 b3 5d c7
|
47
|
+
A8A9AAABADAEAFB0B2B3B4B5B7B8B9BABCBDBEBFC1C2C3C4C6C7C8C9CBCCCDCE 27 96 3c 8f ac df 73 06 28 67 d1 64 df 6d 06 4c
|
48
|
+
D0D1D2D3D5D6D7D8DADBDCDDDFE0E1E2E4E5E6E7E9EAEBECEEEFF0F1F3F4F5F6 77 b1 ce 38 6b 55 1b 99 5f 2f 2a 1d a9 94 ee f8
|
49
|
+
F8F9FAFBFDFEFE00020304050708090A0C0D0E0F11121314161718191B1C1D1E f0 83 38 8b 01 36 79 ef cf 0b b9 b1 5d 52 ae 5c
|
50
|
+
20212223252627282A2B2C2D2F30313234353637393A3B3C3E3F404143444546 c5 00 9e 0d ab 55 db 0a bd b6 36 f2 60 02 90 c8
|
51
|
+
48494A4B4D4E4F50525354555758595A5C5D5E5F61626364666768696B6C6D6E 78 04 88 1e 26 cd 53 2d 85 14 d3 68 3f 00 f1 b9
|
52
|
+
70717273757677787A7B7C7D7F80818284858687898A8B8C8E8F909193949596 46 cd dc d7 3d 1e b5 3e 67 5c a0 12 87 0a 92 a3
|
53
|
+
98999A9B9D9E9FA0A2A3A4A5A7A8A9AAACADAEAFB1B2B3B4B6B7B8B9BBBCBDBE a9 fb 44 06 2b b0 7f e1 30 a8 e8 29 9e ac b1 ab
|
54
|
+
C0C1C2C3C5C6C7C8CACBCCCDCFD0D1D2D4D5D6D7D9DADBDCDEDFE0E1E3E4E5E6 2b 6f f8 d7 a5 cc 3a 28 a2 2d 5a 6f 22 1a f2 6b
|
55
|
+
E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FAFCFDFEFF01020304060708090B0C0D0E 1a 95 27 c2 9b 8a dd 4b 0e 3e 65 6d bb 2a f8 b4
|
56
|
+
10111213151617181A1B1C1D1F20212224252627292A2B2C2E2F303133343536 7f 99 cf 2c 75 24 4d f0 15 eb 4b 0c 10 50 ae ae
|
57
|
+
38393A3B3D3E3F40424344454748494A4C4D4E4F51525354565758595B5C5D5E e8 4f f8 5b 0d 94 54 07 19 09 c1 38 16 46 c4 ed
|
58
|
+
60616263656667686A6B6C6D6F70717274757677797A7B7C7E7F808183848586 89 af d4 0f 99 52 12 80 d5 39 9b 12 40 4f 6d b4
|
59
|
+
88898A8B8D8E8F90929394959798999A9C9D9E9FA1A2A3A4A6A7A8A9ABACADAE a0 9e f3 2d bc 51 19 a3 5a b7 fa 38 65 6f 03 29
|
60
|
+
B0B1B2B3B5B6B7B8BABBBCBDBFC0C1C2C4C5C6C7C9CACBCCCECFD0D1D3D4D5D6 61 77 34 57 f0 68 c3 76 c7 82 9b 93 e6 96 e7 16
|
61
|
+
D8D9DADBDDDEDFE0E2E3E4E5E7E8E9EAECEDEEEFF1F2F3F4F6F7F8F9FBFCFDFE a3 4f 0c ae 72 6c ce 41 dd 49 87 47 d8 91 b9 67
|
62
|
+
00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526 85 6f 59 49 6c 73 88 ee 2d 2b 1a 27 b7 69 78 47
|
63
|
+
28292A2B2D2E2F30323334353738393A3C3D3E3F41424344464748494B4C4D4E cb 09 0c 59 3e f7 72 0b d9 59 08 fb 93 b4 9d f4
|
64
|
+
50515253555657585A5B5C5D5F60616264656667696A6B6C6E6F707173747576 a0 ac 75 cd 2f 19 23 d4 60 fc 4d 45 7a d9 5b af
|
65
|
+
78797A7B7D7E7F80828384858788898A8C8D8E8F91929394969798999B9C9D9E 28 28 2c c7 d2 1d 6a 29 23 64 1e 52 d1 88 ef 0c
|
66
|
+
A0A1A2A3A5A6A7A8AAABACADAFB0B1B2B4B5B6B7B9BABBBCBEBFC0C1C3C4C5C6 0d fa 5b 02 ab b1 8e 5a 81 53 05 21 6d 6d 4f 8e
|
67
|
+
C8C9CACBCDCECFD0D2D3D4D5D7D8D9DADCDDDEDFE1E2E3E4E6E7E8E9EBECEDEE 73 59 63 5c 0e ec ef e3 1d 67 33 95 fb 46 fb 99
|
68
|
+
F0F1F2F3F5F6F7F8FAFBFCFDFE01000204050607090A0B0C0E0F101113141516 73 c6 79 f7 d5 ae f2 74 5c 97 37 bb 4c 47 fb 36
|
69
|
+
18191A1B1D1E1F20222324252728292A2C2D2E2F31323334363738393B3C3D3E b1 92 bd 47 2a 4d 2e af b7 86 e9 74 58 96 76 26
|
70
|
+
40414243454647484A4B4C4D4F50515254555657595A5B5C5E5F606163646566 0e c3 27 f6 c8 a2 b1 47 59 8c a3 fd e6 1d c6 a4
|
71
|
+
68696A6B6D6E6F70727374757778797A7C7D7E7F81828384868788898B8C8D8E fc 41 8e b3 c4 1b 85 9b 38 d4 b6 f6 46 62 97 29
|
72
|
+
90919293959697989A9B9C9D9FA0A1A2A4A5A6A7A9AAABACAEAFB0B1B3B4B5B6 30 24 9e 5a c2 82 b1 c9 81 ea 64 b6 09 f3 a1 54
|
73
|
+
B8B9BABBBDBEBFC0C2C3C4C5C7C8C9CACCCDCECFD1D2D3D4D6D7D8D9DBDCDDDE 5e 6e 08 64 6d 12 15 07 76 bb 43 c2 d7 8a 97 03
|
74
|
+
E0E1E2E3E5E6E7E8EAEBECEDEFF0F1F2F4F5F6F7F9FAFBFCFEFE010103040506 fa eb 3d 5d e6 52 cd 34 47 dc eb 34 3f 30 39 4a
|
75
|
+
08090A0B0D0E0F10121314151718191A1C1D1E1F21222324262728292B2C2D2E a8 e8 87 06 82 3f 69 93 ef 80 d0 5c 1c 7b 2c f0
|
76
|
+
30313233353637383A3B3C3D3F40414244454647494A4B4C4E4F505153545556 8c ed 86 67 7e 6e 00 a1 a1 b1 59 68 f2 d3 cc e6
|
77
|
+
58595A5B5D5E5F60626364656768696A6C6D6E6F71727374767778797B7C7D7E 9f c7 c2 38 58 be 03 bd eb b8 4e 90 db 67 86 a9
|
78
|
+
80818283858687888A8B8C8D8F90919294959697999A9B9C9E9FA0A1A3A4A5A6 b4 fb d6 5b 33 f7 0d 8c f7 f1 11 1a c4 64 9c 36
|
79
|
+
A8A9AAABADAEAFB0B2B3B4B5B7B8B9BABCBDBEBFC1C2C3C4C6C7C8C9CBCCCDCE c5 c3 2d 5e d0 3c 4b 53 cc 8c 1b d0 ef 0d bb f6
|
80
|
+
D0D1D2D3D5D6D7D8DADBDCDDDFE0E1E2E4E5E6E7E9EAEBECEEEFF0F1F3F4F5F6 d1 a7 f0 3b 77 3e 5c 21 24 64 b6 37 09 c6 a8 91
|
81
|
+
F8F9FAFBFDFEFE00020304050708090A0C0D0E0F11121314161718191B1C1D1E 6b 71 61 d8 74 59 47 ac 69 50 43 8e a1 38 d0 28
|
82
|
+
20212223252627282A2B2C2D2F30313234353637393A3B3C3E3F404143444546 fd 47 a9 f7 e3 66 ee 7a 09 bc 50 8b 00 46 06 61
|
83
|
+
48494A4B4D4E4F50525354555758595A5C5D5E5F61626364666768696B6C6D6E 00 d4 0b 00 3d c3 a0 d9 31 0b 65 9b 98 c7 e4 16
|
84
|
+
70717273757677787A7B7C7D7F80818284858687898A8B8C8E8F909193949596 ee a4 c7 9d cc 8e 2b da 69 1f 20 ac 48 be 07 17
|
85
|
+
98999A9B9D9E9FA0A2A3A4A5A7A8A9AAACADAEAFB1B2B3B4B6B7B8B9BBBCBDBE e7 8f 43 b1 1c 20 44 03 e5 75 1f 89 d0 5a 25 09
|
86
|
+
C0C1C2C3C5C6C7C8CACBCCCDCFD0D1D2D4D5D6D7D9DADBDCDEDFE0E1E3E4E5E6 d0 f0 e3 d1 f1 24 4b b9 79 93 1e 38 dd 17 86 ef
|
87
|
+
E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FAFCFDFEFF01020304060708090B0C0D0E 04 2e 63 9d c4 e1 e4 dd e7 b7 5b 74 9e a6 f7 65
|
88
|
+
10111213151617181A1B1C1D1F20212224252627292A2B2C2E2F303133343536 bc 03 2f dd 0e fe 29 50 3a 98 0a 7d 07 ab 46 a8
|
89
|
+
38393A3B3D3E3F40424344454748494A4C4D4E4F51525354565758595B5C5D5E 0c 93 ac 94 9c 0d a6 44 6e ff b8 61 83 b6 c9 10
|
90
|
+
60616263656667686A6B6C6D6F70717274757677797A7B7C7E7F808183848586 e0 d3 43 e1 4d a7 5c 91 7b 4a 5c ec 48 10 d7 c2
|
91
|
+
88898A8B8D8E8F90929394959798999A9C9D9E9FA1A2A3A4A6A7A8A9ABACADAE 0e af b8 21 74 84 08 27 9b 93 7b 62 67 92 e6 19
|
92
|
+
B0B1B2B3B5B6B7B8BABBBCBDBFC0C1C2C4C5C6C7C9CACBCCCECFD0D1D3D4D5D6 fa 1a c6 e0 2d 23 b1 06 a1 fe f1 8b 27 4a 55 3f
|
93
|
+
D8D9DADBDDDEDFE0E2E3E4E5E7E8E9EAECEDEEEFF1F2F3F4F6F7F8F9FBFCFDFE 0d ad fe 01 9c d1 23 68 07 55 07 df 33 c1 a1 e9
|
94
|
+
00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526 3a 08 79 b4 14 46 5d 9f fb af 86 b3 3a 63 a1 b9
|
95
|
+
28292A2B2D2E2F30323334353738393A3C3D3E3F41424344464748494B4C4D4E 62 19 9f ad c7 6d 0b e1 80 5d 3b a0 b7 d9 14 bf
|
96
|
+
50515253555657585A5B5C5D5F60616264656667696A6B6C6E6F707173747576 1b 06 d6 c5 d3 33 e7 42 73 01 30 cf 78 e7 19 b4
|
97
|
+
78797A7B7D7E7F80828384858788898A8C8D8E8F91929394969798999B9C9D9E f1 f8 48 82 4c 32 e9 dc dc bf 21 58 0f 06 93 29
|
98
|
+
A0A1A2A3A5A6A7A8AAABACADAFB0B1B2B4B5B6B7B9BABBBCBEBFC0C1C3C4C5C6 1a 09 05 0c bd 68 4f 78 4d 8e 96 5e 07 82 f2 8a
|
99
|
+
C8C9CACBCDCECFD0D2D3D4D5D7D8D9DADCDDDEDFE1E2E3E4E6E7E8E9EBECEDEE 79 c2 96 9e 7d ed 2b a7 d0 88 f3 f3 20 69 23 60
|
100
|
+
F0F1F2F3F5F6F7F8FAFBFCFDFE01000204050607090A0B0C0E0F101113141516 09 1a 65 8a 2f 74 44 c1 6a cc b6 69 45 0c 7b 63
|
101
|
+
18191A1B1D1E1F20222324252728292A2C2D2E2F31323334363738393B3C3D3E 97 c1 e3 a7 2c ca 65 fa 97 7d 5e d0 e8 a7 bb fc
|
102
|
+
40414243454647484A4B4C4D4F50515254555657595A5B5C5E5F606163646566 70 c4 30 c6 db 9a 17 82 89 37 30 5a 2d f9 1a 2a
|
103
|
+
68696A6B6D6E6F70727374757778797A7C7D7E7F81828384868788898B8C8D8E 62 95 53 45 7f be 24 79 09 85 71 c7 c9 03 fd e8
|
104
|
+
90919293959697989A9B9C9D9FA0A1A2A4A5A6A7A9AAABACAEAFB0B1B3B4B5B6 a2 5b 25 a6 1f 61 26 69 e7 d9 12 65 c7 d4 76 ba
|
105
|
+
B8B9BABBBDBEBFC0C2C3C4C5C7C8C9CACCCDCECFD1D2D3D4D6D7D8D9DBDCDDDE eb 7e 4e 49 b8 ae 0f 02 45 70 dd a2 93 25 4f ed
|
106
|
+
E0E1E2E3E5E6E7E8EAEBECEDEFF0F1F2F4F5F6F7F9FAFBFCFEFE010103040506 38 fe 15 d6 1c ca 84 51 6e 92 4a dc e5 01 4f 67
|
107
|
+
08090A0B0D0E0F10121314151718191A1C1D1E1F21222324262728292B2C2D2E 3a d2 08 49 22 49 10 8c 9f 3e be b1 67 ad 05 83
|
108
|
+
30313233353637383A3B3C3D3F40414244454647494A4B4C4E4F505153545556 29 9b a9 f9 bf 5a b0 5c 35 80 fc 26 ed d1 ed 12
|
109
|
+
58595A5B5D5E5F60626364656768696A6C6D6E6F71727374767778797B7C7D7E 19 dc 70 5b 85 7a 60 fb 07 71 7b 2e a5 71 77 81
|
110
|
+
80818283858687888A8B8C8D8F90919294959697999A9B9C9E9FA0A1A3A4A5A6 ff c8 ae b8 85 b5 ef ca d0 6b 6d be bf 92 e7 6b
|
111
|
+
A8A9AAABADAEAFB0B2B3B4B5B7B8B9BABCBDBEBFC1C2C3C4C6C7C8C9CBCCCDCE f5 89 00 c5 e0 b3 85 25 3f f2 54 62 50 a0 14 2b
|
112
|
+
D0D1D2D3D5D6D7D8DADBDCDDDFE0E1E2E4E5E6E7E9EAEBECEEEFF0F1F3F4F5F6 2e e6 7b 56 28 0b c4 62 42 9c ee 6e 33 70 cb c1
|
113
|
+
F8F9FAFBFDFEFE00020304050708090A0C0D0E0F11121314161718191B1C1D1E 20 db 65 0a 9c 8e 9a 84 ab 4d 25 f7 ed c8 f0 3f
|
114
|
+
20212223252627282A2B2C2D2F30313234353637393A3B3C3E3F404143444546 3c 36 da 16 95 25 cf 81 88 43 80 5f 25 b7 8a e5
|
115
|
+
48494A4B4D4E4F50525354555758595A5C5D5E5F61626364666768696B6C6D6E 9a 78 1d 96 0d b9 e4 5e 37 77 90 42 fe a5 19 22
|
116
|
+
70717273757677787A7B7C7D7F80818284858687898A8B8C8E8F909193949596 65 60 39 5e c2 69 c6 72 a3 c2 88 22 6e fd ba 77
|
117
|
+
98999A9B9D9E9FA0A2A3A4A5A7A8A9AAACADAEAFB1B2B3B4B6B7B8B9BBBCBDBE 8c 77 2b 7a 18 9a c5 44 45 3d 59 16 eb b2 7b 9a
|
118
|
+
C0C1C2C3C5C6C7C8CACBCCCDCFD0D1D2D4D5D6D7D9DADBDCDEDFE0E1E3E4E5E6 77 ca 54 68 cc 48 e8 43 d0 5f 78 ee d9 d6 57 8f
|
119
|
+
E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FAFCFDFEFF01020304060708090B0C0D0E 72 cd cc 71 dc 82 c6 0d 44 29 c9 e2 d8 19 5b aa
|
120
|
+
10111213151617181A1B1C1D1F20212224252627292A2B2C2E2F303133343536 80 80 d6 8c e6 0e 94 b4 0b 5b 8b 69 ee b3 5a fa
|
121
|
+
38393A3B3D3E3F40424344454748494A4C4D4E4F51525354565758595B5C5D5E 44 22 2d 3c de 29 9c 04 36 9d 58 ac 0e ba 1e 8e
|
122
|
+
60616263656667686A6B6C6D6F70717274757677797A7B7C7E7F808183848586 9b 87 21 b0 a8 df c6 91 c5 bc 58 85 db fc b2 7a
|
123
|
+
88898A8B8D8E8F90929394959798999A9C9D9E9FA1A2A3A4A6A7A8A9ABACADAE 0d c0 15 ce 9a 3a 34 14 b5 e6 2e c6 43 38 41 83
|
124
|
+
B0B1B2B3B5B6B7B8BABBBCBDBFC0C1C2C4C5C6C7C9CACBCCCECFD0D1D3D4D5D6 70 57 15 44 8a 8d a4 12 02 5c e3 83 45 c2 a1 48
|
125
|
+
D8D9DADBDDDEDFE0E2E3E4E5E7E8E9EAECEDEEEFF1F2F3F4F6F7F8F9FBFCFDFE c3 2b 5b 0b 6f ba e1 65 26 6c 56 9f 4b 6e cf 0b
|
126
|
+
00010203050607080A0B0C0D0F10111214151617191A1B1C1E1F202123242526 4d ca 6c 75 19 2a 01 dd ca 94 76 af 2a 52 1e 87
|
127
|
+
28292A2B2D2E2F30323334353738393A3C3D3E3F41424344464748494B4C4D4E 05 86 91 e6 27 ec bc 36 ac 07 b6 db 42 3b d6 98
|
128
|
+
50515253555657585A5B5C5D5F60616264656667696A6B6C6E6F707173747576 74 44 52 70 95 83 8f e0 80 fc 2b cd d3 08 47 eb
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.dirname(__FILE__) + '/../lib/ruby-aes'
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
KEY_LENGTH = [128,192,256].freeze
|
7
|
+
MODES = ['ECB','CBC','OFB','CFB'].freeze
|
8
|
+
|
9
|
+
def random_fill(n, buffer)
|
10
|
+
n.times do
|
11
|
+
buffer << rand(256).chr
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestRubyAES < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@keys = {}
|
7
|
+
KEY_LENGTH.each do |kl|
|
8
|
+
@keys[kl] = ""
|
9
|
+
random_fill(kl/8, @keys[kl])
|
10
|
+
end
|
11
|
+
|
12
|
+
@iv = ""
|
13
|
+
random_fill(16, @iv)
|
14
|
+
@pt = ""
|
15
|
+
random_fill(64, @pt)
|
16
|
+
@kl = KEY_LENGTH[(rand * KEY_LENGTH).to_i]
|
17
|
+
@mode = MODES[(rand * MODES.length).to_i]
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_modes_and_key_lengths
|
21
|
+
MODES.each do |mode|
|
22
|
+
KEY_LENGTH.each do |kl|
|
23
|
+
ct = Aes.encrypt_block(kl, mode, @keys[kl], @iv, @pt)
|
24
|
+
npt = Aes.decrypt_block(kl, mode, @keys[kl], @iv, ct)
|
25
|
+
assert_equal(@pt, npt, "Error in encryption/decryption (#{kl}-#{mode})")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_encrypt_stream
|
31
|
+
file = "_ruby-aes_test_encrypt_stream_"
|
32
|
+
sin = File.open(file, "w+b")
|
33
|
+
random_fill(4242, sin)
|
34
|
+
sout = File.open("#{file}.aes", "w+b")
|
35
|
+
Aes.encrypt_stream(@kl, @mode, @keys[@kl], @iv, sin, sout)
|
36
|
+
sin.close
|
37
|
+
sout.close
|
38
|
+
|
39
|
+
sin = File.open("#{file}.aes", "rb")
|
40
|
+
sout = File.open("#{file}.plain", "w+b")
|
41
|
+
Aes.decrypt_stream(@kl, @mode, @keys[@kl], @iv, sin, sout)
|
42
|
+
sin.close
|
43
|
+
sout.close
|
44
|
+
|
45
|
+
assert_equal IO.read(file), IO.read("#{file}.plain"),
|
46
|
+
"Error in encrypt_stream"
|
47
|
+
FileUtils.rm_f [ file, "#{file}.aes", "#{file}.plain" ]
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_encrypt_buffer
|
51
|
+
pt = ""
|
52
|
+
42.times do
|
53
|
+
pt << random_fill(1, pt)
|
54
|
+
ct = Aes.encrypt_buffer(@kl, @mode, @keys[@kl], @iv, pt)
|
55
|
+
npt = Aes.decrypt_buffer(@kl, @mode, @keys[@kl], @iv, ct)
|
56
|
+
assert_equal(pt, npt, "Error in encrypt buffer (padding)")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_check_key_length
|
61
|
+
assert_raise(RuntimeError) do
|
62
|
+
Aes.check_kl(42)
|
63
|
+
end
|
64
|
+
KEY_LENGTH.each do |kl|
|
65
|
+
assert_nothing_raised do
|
66
|
+
Aes.check_kl(kl)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_check_iv
|
72
|
+
assert_raise(RuntimeError) do
|
73
|
+
Aes.check_iv(@iv.unpack('H*'))
|
74
|
+
end
|
75
|
+
assert_nothing_raised do
|
76
|
+
Aes.check_iv(@iv)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_check_key
|
81
|
+
assert_raise(RuntimeError) do
|
82
|
+
Aes.check_key(@key, 64)
|
83
|
+
end # bad key length
|
84
|
+
assert_raise(RuntimeError) do
|
85
|
+
Aes.check_key('123', 128)
|
86
|
+
end # bad key string
|
87
|
+
assert_raise(RuntimeError) do
|
88
|
+
Aes.check_key(@key, 256)
|
89
|
+
end # bad key string
|
90
|
+
assert_raise(RuntimeError) do
|
91
|
+
Aes.check_key(@key.unpack('H*'), 128)
|
92
|
+
end # bad key string
|
93
|
+
assert_nothing_raised do
|
94
|
+
Aes.check_key(@key, @kl)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_check_mode
|
99
|
+
assert_raise(RuntimeError) do
|
100
|
+
Aes.check_mode('ABC')
|
101
|
+
end
|
102
|
+
MODES.each do |mode|
|
103
|
+
assert_nothing_raised do
|
104
|
+
Aes.check_mode(mode)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_truth
|
110
|
+
assert true
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.3
|
3
|
+
specification_version: 1
|
4
|
+
name: ruby-aes-cext
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: "1.0"
|
7
|
+
date: 2007-08-01 00:00:00 +02:00
|
8
|
+
summary: ruby-aes is an implementation of the Rijndael algorithm (AES)
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
- ext
|
12
|
+
email: alex.boussinet@gmail.com
|
13
|
+
homepage: http://ruby-aes.rubyforge.org
|
14
|
+
rubyforge_project: ruby-aes
|
15
|
+
description: ruby-aes is an implementation of the Rijndael algorithm (AES)
|
16
|
+
autorequire:
|
17
|
+
default_executable:
|
18
|
+
bindir: bin
|
19
|
+
has_rdoc: true
|
20
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
platform: i686-linux
|
27
|
+
signing_key:
|
28
|
+
cert_chain:
|
29
|
+
post_install_message:
|
30
|
+
authors:
|
31
|
+
- Alex Boussinet
|
32
|
+
files:
|
33
|
+
- CHANGELOG
|
34
|
+
- COPYING
|
35
|
+
- README
|
36
|
+
- Rakefile
|
37
|
+
- examples/encrypt_block.rb
|
38
|
+
- examples/example_helper.rb
|
39
|
+
- examples/encrypt_stream.rb
|
40
|
+
- examples/encrypt_buffer.rb
|
41
|
+
- lib/ruby-aes
|
42
|
+
- lib/ruby-aes.rb
|
43
|
+
- test/test_ruby-aes.rb
|
44
|
+
- test/test_helper.rb
|
45
|
+
- test/KAT_MCT
|
46
|
+
- test/KAT_MCT/rijndael-vals.zip
|
47
|
+
- test/KAT_MCT/table.128
|
48
|
+
- test/KAT_MCT/table.192
|
49
|
+
- test/KAT_MCT/table.256
|
50
|
+
- test/KAT_MCT/aes_kat_mct.rb
|
51
|
+
- ext/ruby-aes/aes_alg.so
|
52
|
+
test_files:
|
53
|
+
- test/test_ruby-aes.rb
|
54
|
+
- test/test_helper.rb
|
55
|
+
rdoc_options:
|
56
|
+
- --quiet
|
57
|
+
- --title
|
58
|
+
- ruby-aes reference
|
59
|
+
- --opname
|
60
|
+
- index.html
|
61
|
+
- --exclude
|
62
|
+
- ext
|
63
|
+
- --line-numbers
|
64
|
+
- --main
|
65
|
+
- README
|
66
|
+
- --inline-source
|
67
|
+
extra_rdoc_files:
|
68
|
+
- README
|
69
|
+
- CHANGELOG
|
70
|
+
- COPYING
|
71
|
+
executables: []
|
72
|
+
|
73
|
+
extensions: []
|
74
|
+
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
dependencies: []
|
78
|
+
|