ruby-aes-optimized 1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,129 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: COPYING</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>COPYING</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>COPYING
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sun Jul 29 18:32:22 CEST 2007</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ Copyright &#169; 2007 Alex Boussinet
74
+ </p>
75
+ <p>
76
+ Permission is hereby granted, free of charge, to any person obtaining a
77
+ copy of this software and associated documentation files (the
78
+ &quot;Software&quot;), to deal in the Software without restriction,
79
+ including without limitation the rights to use, copy, modify, merge,
80
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
81
+ permit persons to whom the Software is furnished to do so, subject to the
82
+ following conditions:
83
+ </p>
84
+ <p>
85
+ The above copyright notice and this permission notice shall be included in
86
+ all copies or substantial portions of the Software.
87
+ </p>
88
+ <p>
89
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
90
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
92
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
93
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
94
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
95
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
96
+ </p>
97
+
98
+ </div>
99
+
100
+
101
+ </div>
102
+
103
+
104
+ </div>
105
+
106
+
107
+ <!-- if includes -->
108
+
109
+ <div id="section">
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <!-- if method_list -->
119
+
120
+
121
+ </div>
122
+
123
+
124
+ <div id="validator-badges">
125
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
126
+ </div>
127
+
128
+ </body>
129
+ </html>
@@ -0,0 +1,235 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: README</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>README</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sun Jul 29 18:32:22 CEST 2007</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ README for ruby-aes
74
+ </p>
75
+ <h6>=============</h6>
76
+ <p>
77
+ Ruby AES &lt;<a
78
+ href="http://rubyforge.org/projects/ruby-aes">rubyforge.org/projects/ruby-aes</a>&gt;
79
+ is an implementation of the Rijndael algorithm.
80
+ </p>
81
+ <p>
82
+ Written by Alex Boussinet &lt;<a
83
+ href="mailto:alex.boussinet@gmail.com">alex.boussinet@gmail.com</a>&gt;
84
+ </p>
85
+ <p>
86
+ This release is mainly an import from the Ruby Application Archive (RAA).
87
+ I&#8217;ve added all the versions I was working on (algorithm variations)
88
+ and a new C extension for improved performance. 6 variations are available:
89
+ </p>
90
+ <ul>
91
+ <li>&quot;Normal&quot;:
92
+
93
+ </li>
94
+ </ul>
95
+ <p>
96
+ Pure Ruby implementation of the Rijndael algorithm specifications. Useful
97
+ for understanding the algorithm.
98
+ </p>
99
+ <ul>
100
+ <li>&quot;Optimized&quot;:
101
+
102
+ </li>
103
+ </ul>
104
+ <p>
105
+ Pure Ruby implementation based on the &quot;Normal&quot; code but optimized
106
+ for speed. The SubBytes and ShiftRows methods have been combined.
107
+ </p>
108
+ <ul>
109
+ <li>&quot;Table Optimized 1&quot;:
110
+
111
+ </li>
112
+ </ul>
113
+ <p>
114
+ Pure Ruby implementation based on the C code from the Rijndael website. The
115
+ arrays of constants are bigger because all the operations are already
116
+ computed so it&#8217;s mainly based on table look ups.
117
+ </p>
118
+ <ul>
119
+ <li>&quot;Table Optimized 2&quot;:
120
+
121
+ </li>
122
+ </ul>
123
+ <p>
124
+ Pure Ruby implementation based on the &quot;Table Optimized 1&quot; code.
125
+ The arrays of constants are bigger because all the operations are already
126
+ computed and table look ups are also combined.
127
+ </p>
128
+ <ul>
129
+ <li>&quot;Table Unroll Optimized 1&quot;:
130
+
131
+ </li>
132
+ </ul>
133
+ <p>
134
+ Pure Ruby implementation based on the &quot;Table Optimized 1&quot; code.
135
+ The change here is that the loops are unrolled.
136
+ </p>
137
+ <ul>
138
+ <li>&quot;Table Unroll Optimized 2&quot;:
139
+
140
+ </li>
141
+ </ul>
142
+ <p>
143
+ Pure Ruby implementation based on the &quot;Table Optimized 2&quot; code.
144
+ The change here is that the loops are unrolled.
145
+ </p>
146
+ <ul>
147
+ <li>&quot;EXT Table Unroll Optimized 2&quot;:
148
+
149
+ </li>
150
+ </ul>
151
+ <p>
152
+ C extension based on the &quot;Table Unroll Optimized 2&quot; code. This
153
+ extension is provided for major speed improvement.
154
+ </p>
155
+ <p>
156
+ All those variations share the same API:
157
+ </p>
158
+ <pre>
159
+ Default key_length: 128
160
+ Default mode: 'ECB'
161
+ Default IV: 16 null chars (&quot;00&quot; * 16 in hex format)
162
+ Default key: 16 null chars (&quot;00&quot; * 16 in hex format)
163
+ Default input text: &quot;PLAINTEXT&quot;
164
+
165
+ Aes.check_key(key_string, key_length)
166
+ Aes.check_iv(iv_string)
167
+ Aes.check_kl(key_length)
168
+ Aes.check_mode(mode)
169
+ Aes.init(key_length, mode, key, iv)
170
+ Aes.encrypt_block(key_length, mode, key, iv, block) # no padding
171
+ Aes.decrypt_block(key_length, mode, key, iv, block) # no padding
172
+ Aes.encrypt_buffer(key_length, mode, key, iv, block) # padding
173
+ Aes.decrypt_buffer(key_length, mode, key, iv, block) # padding
174
+ Aes.encrypt_stream(key_length, mode, key, iv, sin, sout)
175
+ Aes.decrypt_stream(key_length, mode, key, iv, sin, sout)
176
+ Aes.bs() # block size for read operations (stream)
177
+ Aes.bs=(bs)
178
+ </pre>
179
+ <p>
180
+ Valid modes are:
181
+ </p>
182
+ <pre>
183
+ * ECB (Electronic Code Book)
184
+ * CBC (Cipher Block Chaining)
185
+ * OFB (Output Feedback)
186
+ * CFB (Cipher Feedback)
187
+ </pre>
188
+ <p>
189
+ Valid key length:
190
+ </p>
191
+ <pre>
192
+ * 128 bits
193
+ * 192 bits
194
+ * 256 bits
195
+ </pre>
196
+ <p>
197
+ For a really good encryption, 256 bits CBC is recommanded.
198
+ </p>
199
+ <p>
200
+ For more information on AES-Rijndael, see: &lt;<a
201
+ href="http://csrc.nist.gov/encryption/aes/rijndael">csrc.nist.gov/encryption/aes/rijndael</a>/&gt;
202
+ </p>
203
+
204
+ </div>
205
+
206
+
207
+ </div>
208
+
209
+
210
+ </div>
211
+
212
+
213
+ <!-- if includes -->
214
+
215
+ <div id="section">
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+ <!-- if method_list -->
225
+
226
+
227
+ </div>
228
+
229
+
230
+ <div id="validator-badges">
231
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
232
+ </div>
233
+
234
+ </body>
235
+ </html>
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: ruby-aes.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>ruby-aes.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/ruby-aes.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sun Jul 29 18:32:22 CEST 2007</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ ruby-aes/aes_alg&nbsp;&nbsp;
77
+ </div>
78
+ </div>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+
86
+ <!-- if includes -->
87
+
88
+ <div id="section">
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <!-- if method_list -->
98
+
99
+
100
+ </div>
101
+
102
+
103
+ <div id="validator-badges">
104
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
105
+ </div>
106
+
107
+ </body>
108
+ </html>
@@ -0,0 +1,29 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Classes
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Classes</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Classes</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/Aes.html">Aes</a><br />
24
+ <a href="classes/AesAlg.html">AesAlg</a><br />
25
+ <a href="classes/AesCons.html">AesCons</a><br />
26
+ </div>
27
+ </div>
28
+ </body>
29
+ </html>
@@ -0,0 +1,32 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/CHANGELOG.html">CHANGELOG</a><br />
24
+ <a href="files/COPYING.html">COPYING</a><br />
25
+ <a href="files/README.html">README</a><br />
26
+ <a href="files/lib/ruby-aes_rb.html">lib/ruby-aes.rb</a><br />
27
+ <a href="files/lib/ruby-aes/aes_alg_rb.html">lib/ruby-aes/aes_alg.rb</a><br />
28
+ <a href="files/lib/ruby-aes/aes_cons_rb.html">lib/ruby-aes/aes_cons.rb</a><br />
29
+ </div>
30
+ </div>
31
+ </body>
32
+ </html>
@@ -0,0 +1,57 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/AesAlg.html#M000009">_decrypt_block (AesAlg)</a><br />
24
+ <a href="classes/AesAlg.html#M000008">_encrypt_block (AesAlg)</a><br />
25
+ <a href="classes/AesAlg.html#M000006">addRoundKey (AesAlg)</a><br />
26
+ <a href="classes/Aes.html#M000019">bs (Aes)</a><br />
27
+ <a href="classes/Aes.html#M000020">bs= (Aes)</a><br />
28
+ <a href="classes/Aes.html#M000022">check_iv (Aes)</a><br />
29
+ <a href="classes/Aes.html#M000021">check_key (Aes)</a><br />
30
+ <a href="classes/Aes.html#M000024">check_kl (Aes)</a><br />
31
+ <a href="classes/Aes.html#M000023">check_mode (Aes)</a><br />
32
+ <a href="classes/AesAlg.html#M000005">decryptSubRound (AesAlg)</a><br />
33
+ <a href="classes/Aes.html#M000027">decrypt_block (Aes)</a><br />
34
+ <a href="classes/AesAlg.html#M000012">decrypt_block (AesAlg)</a><br />
35
+ <a href="classes/AesAlg.html#M000014">decrypt_blocks (AesAlg)</a><br />
36
+ <a href="classes/Aes.html#M000029">decrypt_buffer (Aes)</a><br />
37
+ <a href="classes/AesAlg.html#M000016">decrypt_buffer (AesAlg)</a><br />
38
+ <a href="classes/Aes.html#M000031">decrypt_stream (Aes)</a><br />
39
+ <a href="classes/Aes.html#M000026">encrypt_block (Aes)</a><br />
40
+ <a href="classes/AesAlg.html#M000011">encrypt_block (AesAlg)</a><br />
41
+ <a href="classes/AesAlg.html#M000013">encrypt_blocks (AesAlg)</a><br />
42
+ <a href="classes/AesAlg.html#M000015">encrypt_buffer (AesAlg)</a><br />
43
+ <a href="classes/Aes.html#M000028">encrypt_buffer (Aes)</a><br />
44
+ <a href="classes/Aes.html#M000030">encrypt_stream (Aes)</a><br />
45
+ <a href="classes/AesAlg.html#M000002">imixColumns (AesAlg)</a><br />
46
+ <a href="classes/AesAlg.html#M000017">init (AesAlg)</a><br />
47
+ <a href="classes/Aes.html#M000025">init (Aes)</a><br />
48
+ <a href="classes/AesAlg.html#M000007">key_expansion (AesAlg)</a><br />
49
+ <a href="classes/AesAlg.html#M000004">lastEncryptRound (AesAlg)</a><br />
50
+ <a href="classes/AesAlg.html#M000001">mixColumns (AesAlg)</a><br />
51
+ <a href="classes/AesAlg.html#M000018">new (AesAlg)</a><br />
52
+ <a href="classes/AesAlg.html#M000003">subShiftRows (AesAlg)</a><br />
53
+ <a href="classes/AesAlg.html#M000010">xor (AesAlg)</a><br />
54
+ </div>
55
+ </div>
56
+ </body>
57
+ </html>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ ruby-aes reference
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>ruby-aes reference</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README.html" name="docwin" />
23
+ </frameset>
24
+ </html>