ruby-aes-table2 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -1
- data/Rakefile +3 -3
- data/doc/rdoc/classes/Aes.html +112 -106
- data/doc/rdoc/classes/AesShared.html +265 -0
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/CHANGELOG.html +12 -2
- data/doc/rdoc/files/COPYING.html +2 -2
- data/doc/rdoc/files/README.html +3 -3
- data/doc/rdoc/files/lib/ruby-aes/{aes_cons_rb.html → aes_shared_rb.html} +4 -4
- data/doc/rdoc/files/lib/ruby-aes_rb.html +1 -1
- data/doc/rdoc/fr_class_index.html +1 -2
- data/doc/rdoc/fr_file_index.html +1 -2
- data/doc/rdoc/fr_method_index.html +17 -26
- data/examples/encrypt_block.rb +1 -0
- data/examples/encrypt_buffer.rb +1 -0
- data/examples/encrypt_stream.rb +1 -0
- data/lib/ruby-aes/aes_alg.rb +2 -58
- data/lib/ruby-aes/aes_shared.rb +77 -0
- data/lib/ruby-aes.rb +12 -6
- data/test/test_helper.rb +4 -2
- data/test/test_ruby-aes.rb +25 -12
- metadata +14 -15
- data/doc/rdoc/classes/AesAlg.html +0 -740
- data/doc/rdoc/classes/AesCons.html +0 -198
- data/doc/rdoc/files/lib/ruby-aes/aes_alg_rb.html +0 -108
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ require 'fileutils'
|
|
8
8
|
include FileUtils
|
9
9
|
|
10
10
|
@name = 'ruby-aes'
|
11
|
-
@version = '1.
|
11
|
+
@version = '1.1'
|
12
12
|
@native = false
|
13
13
|
|
14
14
|
@lib = "lib/#{@name}"
|
@@ -82,8 +82,8 @@ task :cext do |t|
|
|
82
82
|
SPEC.files += ["#{@ext}/#{@ext_so}"]
|
83
83
|
SPEC.platform = Gem::Platform::CURRENT
|
84
84
|
else
|
85
|
-
SPEC.files +=
|
86
|
-
SPEC.extensions =
|
85
|
+
SPEC.files += [ "#{@ext}/aes_alg.c", "#{@ext}/extconf.rb", "#{@ext}/aes_cons.h" ]
|
86
|
+
SPEC.extensions = "#{@ext}/extconf.rb"
|
87
87
|
end
|
88
88
|
task_gem
|
89
89
|
end
|
data/doc/rdoc/classes/Aes.html
CHANGED
@@ -80,19 +80,19 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
86
|
-
<a href="#
|
87
|
-
<a href="#
|
88
|
-
<a href="#
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
95
|
-
<a href="#
|
83
|
+
<a href="#M000005">bs</a>
|
84
|
+
<a href="#M000006">bs=</a>
|
85
|
+
<a href="#M000008">check_iv</a>
|
86
|
+
<a href="#M000007">check_key</a>
|
87
|
+
<a href="#M000010">check_kl</a>
|
88
|
+
<a href="#M000009">check_mode</a>
|
89
|
+
<a href="#M000013">decrypt_block</a>
|
90
|
+
<a href="#M000015">decrypt_buffer</a>
|
91
|
+
<a href="#M000017">decrypt_stream</a>
|
92
|
+
<a href="#M000012">encrypt_block</a>
|
93
|
+
<a href="#M000014">encrypt_buffer</a>
|
94
|
+
<a href="#M000016">encrypt_stream</a>
|
95
|
+
<a href="#M000011">init</a>
|
96
96
|
</div>
|
97
97
|
</div>
|
98
98
|
|
@@ -114,19 +114,19 @@
|
|
114
114
|
<div id="methods">
|
115
115
|
<h3 class="section-bar">Public Class methods</h3>
|
116
116
|
|
117
|
-
<div id="method-
|
118
|
-
<a name="
|
117
|
+
<div id="method-M000005" class="method-detail">
|
118
|
+
<a name="M000005"></a>
|
119
119
|
|
120
120
|
<div class="method-heading">
|
121
|
-
<a href="#
|
121
|
+
<a href="#M000005" class="method-signature">
|
122
122
|
<span class="method-name">bs</span><span class="method-args">()</span>
|
123
123
|
</a>
|
124
124
|
</div>
|
125
125
|
|
126
126
|
<div class="method-description">
|
127
127
|
<p><a class="source-toggle" href="#"
|
128
|
-
onclick="toggleCode('
|
129
|
-
<div class="method-source-code" id="
|
128
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
129
|
+
<div class="method-source-code" id="M000005-source">
|
130
130
|
<pre>
|
131
131
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 45</span>
|
132
132
|
45: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">bs</span>(); <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@@bs</span> <span class="ruby-keyword kw">end</span>
|
@@ -135,19 +135,19 @@
|
|
135
135
|
</div>
|
136
136
|
</div>
|
137
137
|
|
138
|
-
<div id="method-
|
139
|
-
<a name="
|
138
|
+
<div id="method-M000006" class="method-detail">
|
139
|
+
<a name="M000006"></a>
|
140
140
|
|
141
141
|
<div class="method-heading">
|
142
|
-
<a href="#
|
142
|
+
<a href="#M000006" class="method-signature">
|
143
143
|
<span class="method-name">bs=</span><span class="method-args">(bs)</span>
|
144
144
|
</a>
|
145
145
|
</div>
|
146
146
|
|
147
147
|
<div class="method-description">
|
148
148
|
<p><a class="source-toggle" href="#"
|
149
|
-
onclick="toggleCode('
|
150
|
-
<div class="method-source-code" id="
|
149
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
150
|
+
<div class="method-source-code" id="M000006-source">
|
151
151
|
<pre>
|
152
152
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 46</span>
|
153
153
|
46: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">bs=</span>(<span class="ruby-identifier">bs</span>); <span class="ruby-ivar">@@bs</span> = <span class="ruby-identifier">bs</span>.<span class="ruby-identifier">to_i</span>; <span class="ruby-ivar">@@bs</span><span class="ruby-operator">==</span><span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value">4096</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@@bs</span> = <span class="ruby-ivar">@@bs</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@@bs</span><span class="ruby-operator">%</span><span class="ruby-value">16</span> <span class="ruby-keyword kw">end</span>
|
@@ -156,19 +156,19 @@
|
|
156
156
|
</div>
|
157
157
|
</div>
|
158
158
|
|
159
|
-
<div id="method-
|
160
|
-
<a name="
|
159
|
+
<div id="method-M000008" class="method-detail">
|
160
|
+
<a name="M000008"></a>
|
161
161
|
|
162
162
|
<div class="method-heading">
|
163
|
-
<a href="#
|
163
|
+
<a href="#M000008" class="method-signature">
|
164
164
|
<span class="method-name">check_iv</span><span class="method-args">(iv_string)</span>
|
165
165
|
</a>
|
166
166
|
</div>
|
167
167
|
|
168
168
|
<div class="method-description">
|
169
169
|
<p><a class="source-toggle" href="#"
|
170
|
-
onclick="toggleCode('
|
171
|
-
<div class="method-source-code" id="
|
170
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
171
|
+
<div class="method-source-code" id="M000008-source">
|
172
172
|
<pre>
|
173
173
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 61</span>
|
174
174
|
61: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">check_iv</span>(<span class="ruby-identifier">iv_string</span>)
|
@@ -188,24 +188,24 @@
|
|
188
188
|
</div>
|
189
189
|
</div>
|
190
190
|
|
191
|
-
<div id="method-
|
192
|
-
<a name="
|
191
|
+
<div id="method-M000007" class="method-detail">
|
192
|
+
<a name="M000007"></a>
|
193
193
|
|
194
194
|
<div class="method-heading">
|
195
|
-
<a href="#
|
195
|
+
<a href="#M000007" class="method-signature">
|
196
196
|
<span class="method-name">check_key</span><span class="method-args">(key_string, kl = 128)</span>
|
197
197
|
</a>
|
198
198
|
</div>
|
199
199
|
|
200
200
|
<div class="method-description">
|
201
201
|
<p><a class="source-toggle" href="#"
|
202
|
-
onclick="toggleCode('
|
203
|
-
<div class="method-source-code" id="
|
202
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
203
|
+
<div class="method-source-code" id="M000007-source">
|
204
204
|
<pre>
|
205
205
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 48</span>
|
206
206
|
48: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">check_key</span>(<span class="ruby-identifier">key_string</span>, <span class="ruby-identifier">kl</span> = <span class="ruby-value">128</span>)
|
207
207
|
49: <span class="ruby-identifier">kl</span> = <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">check_kl</span>(<span class="ruby-identifier">kl</span>)
|
208
|
-
50: <span class="ruby-identifier">k</span> = <span class="ruby-identifier">key_string</span>.<span class="ruby-identifier">length</span>
|
208
|
+
50: <span class="ruby-identifier">k</span> = <span class="ruby-identifier">key_string</span> <span class="ruby-value">? </span><span class="ruby-identifier">key_string</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
|
209
209
|
51: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Bad key string or bad key length"</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">k</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">kl</span><span class="ruby-operator">/</span><span class="ruby-value">8</span>) <span class="ruby-operator">&&</span> (<span class="ruby-identifier">k</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">kl</span><span class="ruby-operator">/</span><span class="ruby-value">4</span>)
|
210
210
|
52: <span class="ruby-identifier">hex</span> = (<span class="ruby-identifier">key_string</span> <span class="ruby-operator">=~</span> <span class="ruby-node">/[a-f0-9A-F]{#{k}}/</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">&&</span> (<span class="ruby-identifier">k</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">kl</span><span class="ruby-operator">/</span><span class="ruby-value">4</span>)
|
211
211
|
53: <span class="ruby-identifier">bin</span> = <span class="ruby-operator">!</span> <span class="ruby-identifier">hex</span>
|
@@ -220,19 +220,19 @@
|
|
220
220
|
</div>
|
221
221
|
</div>
|
222
222
|
|
223
|
-
<div id="method-
|
224
|
-
<a name="
|
223
|
+
<div id="method-M000010" class="method-detail">
|
224
|
+
<a name="M000010"></a>
|
225
225
|
|
226
226
|
<div class="method-heading">
|
227
|
-
<a href="#
|
227
|
+
<a href="#M000010" class="method-signature">
|
228
228
|
<span class="method-name">check_kl</span><span class="method-args">(key_length)</span>
|
229
229
|
</a>
|
230
230
|
</div>
|
231
231
|
|
232
232
|
<div class="method-description">
|
233
233
|
<p><a class="source-toggle" href="#"
|
234
|
-
onclick="toggleCode('
|
235
|
-
<div class="method-source-code" id="
|
234
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
235
|
+
<div class="method-source-code" id="M000010-source">
|
236
236
|
<pre>
|
237
237
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 82</span>
|
238
238
|
82: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">check_kl</span>(<span class="ruby-identifier">key_length</span>)
|
@@ -247,19 +247,19 @@
|
|
247
247
|
</div>
|
248
248
|
</div>
|
249
249
|
|
250
|
-
<div id="method-
|
251
|
-
<a name="
|
250
|
+
<div id="method-M000009" class="method-detail">
|
251
|
+
<a name="M000009"></a>
|
252
252
|
|
253
253
|
<div class="method-heading">
|
254
|
-
<a href="#
|
254
|
+
<a href="#M000009" class="method-signature">
|
255
255
|
<span class="method-name">check_mode</span><span class="method-args">(mode)</span>
|
256
256
|
</a>
|
257
257
|
</div>
|
258
258
|
|
259
259
|
<div class="method-description">
|
260
260
|
<p><a class="source-toggle" href="#"
|
261
|
-
onclick="toggleCode('
|
262
|
-
<div class="method-source-code" id="
|
261
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
262
|
+
<div class="method-source-code" id="M000009-source">
|
263
263
|
<pre>
|
264
264
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 74</span>
|
265
265
|
74: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">check_mode</span> (<span class="ruby-identifier">mode</span>)
|
@@ -274,19 +274,19 @@
|
|
274
274
|
</div>
|
275
275
|
</div>
|
276
276
|
|
277
|
-
<div id="method-
|
278
|
-
<a name="
|
277
|
+
<div id="method-M000013" class="method-detail">
|
278
|
+
<a name="M000013"></a>
|
279
279
|
|
280
280
|
<div class="method-heading">
|
281
|
-
<a href="#
|
281
|
+
<a href="#M000013" class="method-signature">
|
282
282
|
<span class="method-name">decrypt_block</span><span class="method-args">(keyl, mode, key, iv, block = "DEFAULT PLAINTXT")</span>
|
283
283
|
</a>
|
284
284
|
</div>
|
285
285
|
|
286
286
|
<div class="method-description">
|
287
287
|
<p><a class="source-toggle" href="#"
|
288
|
-
onclick="toggleCode('
|
289
|
-
<div class="method-source-code" id="
|
288
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
289
|
+
<div class="method-source-code" id="M000013-source">
|
290
290
|
<pre>
|
291
291
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 106</span>
|
292
292
|
106: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">decrypt_block</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>, <span class="ruby-identifier">block</span> = <span class="ruby-value str">"DEFAULT PLAINTXT"</span>)
|
@@ -298,19 +298,19 @@
|
|
298
298
|
</div>
|
299
299
|
</div>
|
300
300
|
|
301
|
-
<div id="method-
|
302
|
-
<a name="
|
301
|
+
<div id="method-M000015" class="method-detail">
|
302
|
+
<a name="M000015"></a>
|
303
303
|
|
304
304
|
<div class="method-heading">
|
305
|
-
<a href="#
|
305
|
+
<a href="#M000015" class="method-signature">
|
306
306
|
<span class="method-name">decrypt_buffer</span><span class="method-args">(keyl, mode, key, iv, buffer = "DEFAULT PLAINTXT")</span>
|
307
307
|
</a>
|
308
308
|
</div>
|
309
309
|
|
310
310
|
<div class="method-description">
|
311
311
|
<p><a class="source-toggle" href="#"
|
312
|
-
onclick="toggleCode('
|
313
|
-
<div class="method-source-code" id="
|
312
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
313
|
+
<div class="method-source-code" id="M000015-source">
|
314
314
|
<pre>
|
315
315
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 116</span>
|
316
316
|
116: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">decrypt_buffer</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>, <span class="ruby-identifier">buffer</span> = <span class="ruby-value str">"DEFAULT PLAINTXT"</span>)
|
@@ -323,58 +323,61 @@
|
|
323
323
|
</div>
|
324
324
|
</div>
|
325
325
|
|
326
|
-
<div id="method-
|
327
|
-
<a name="
|
326
|
+
<div id="method-M000017" class="method-detail">
|
327
|
+
<a name="M000017"></a>
|
328
328
|
|
329
329
|
<div class="method-heading">
|
330
|
-
<a href="#
|
330
|
+
<a href="#M000017" class="method-signature">
|
331
331
|
<span class="method-name">decrypt_stream</span><span class="method-args">(keyl, mode, key, iv, sin = STDIN, sout = STDOUT)</span>
|
332
332
|
</a>
|
333
333
|
</div>
|
334
334
|
|
335
335
|
<div class="method-description">
|
336
336
|
<p><a class="source-toggle" href="#"
|
337
|
-
onclick="toggleCode('
|
338
|
-
<div class="method-source-code" id="
|
337
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
338
|
+
<div class="method-source-code" id="M000017-source">
|
339
339
|
<pre>
|
340
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
340
|
+
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 145</span>
|
341
|
+
145: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">decrypt_stream</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>, <span class="ruby-identifier">sin</span> = <span class="ruby-constant">STDIN</span>, <span class="ruby-identifier">sout</span> = <span class="ruby-constant">STDOUT</span>)
|
342
|
+
146: <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">init</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>)
|
343
|
+
147: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">sout</span>
|
344
|
+
148: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>, <span class="ruby-constant">Array</span>, <span class="ruby-constant">IO</span>
|
345
|
+
149: <span class="ruby-keyword kw">else</span>
|
346
|
+
150: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Bad output stream (String, Array, IO)"</span>
|
347
|
+
151: <span class="ruby-keyword kw">end</span>
|
348
|
+
152: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">sin</span>
|
349
|
+
153: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
350
|
+
154: <span class="ruby-identifier">sout</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@@aes</span>.<span class="ruby-identifier">decrypt_buffer</span>(<span class="ruby-identifier">sin</span>)
|
351
|
+
155: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">IO</span>
|
352
|
+
156: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">buf</span> = <span class="ruby-identifier">sin</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@@bs</span>)<span class="ruby-comment cmt">#+1)</span>
|
353
|
+
157: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@@bs</span>
|
354
|
+
158: <span class="ruby-identifier">sout</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@@aes</span>.<span class="ruby-identifier">decrypt_blocks</span>(<span class="ruby-identifier">buf</span>)
|
355
|
+
159: <span class="ruby-keyword kw">else</span>
|
356
|
+
160: <span class="ruby-identifier">sout</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@@aes</span>.<span class="ruby-identifier">decrypt_buffer</span>(<span class="ruby-identifier">buf</span>)
|
357
|
+
161: <span class="ruby-keyword kw">end</span>
|
358
|
+
162: <span class="ruby-keyword kw">end</span>
|
359
|
+
163: <span class="ruby-keyword kw">else</span>
|
360
|
+
164: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Bad input stream (String, IO)"</span>
|
361
|
+
165: <span class="ruby-keyword kw">end</span>
|
362
|
+
166: <span class="ruby-keyword kw">end</span>
|
360
363
|
</pre>
|
361
364
|
</div>
|
362
365
|
</div>
|
363
366
|
</div>
|
364
367
|
|
365
|
-
<div id="method-
|
366
|
-
<a name="
|
368
|
+
<div id="method-M000012" class="method-detail">
|
369
|
+
<a name="M000012"></a>
|
367
370
|
|
368
371
|
<div class="method-heading">
|
369
|
-
<a href="#
|
372
|
+
<a href="#M000012" class="method-signature">
|
370
373
|
<span class="method-name">encrypt_block</span><span class="method-args">(keyl, mode, key, iv, block = "DEFAULT PLAINTXT")</span>
|
371
374
|
</a>
|
372
375
|
</div>
|
373
376
|
|
374
377
|
<div class="method-description">
|
375
378
|
<p><a class="source-toggle" href="#"
|
376
|
-
onclick="toggleCode('
|
377
|
-
<div class="method-source-code" id="
|
379
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
380
|
+
<div class="method-source-code" id="M000012-source">
|
378
381
|
<pre>
|
379
382
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 100</span>
|
380
383
|
100: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">encrypt_block</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>, <span class="ruby-identifier">block</span> = <span class="ruby-value str">"DEFAULT PLAINTXT"</span>)
|
@@ -387,19 +390,19 @@
|
|
387
390
|
</div>
|
388
391
|
</div>
|
389
392
|
|
390
|
-
<div id="method-
|
391
|
-
<a name="
|
393
|
+
<div id="method-M000014" class="method-detail">
|
394
|
+
<a name="M000014"></a>
|
392
395
|
|
393
396
|
<div class="method-heading">
|
394
|
-
<a href="#
|
397
|
+
<a href="#M000014" class="method-signature">
|
395
398
|
<span class="method-name">encrypt_buffer</span><span class="method-args">(keyl, mode, key, iv, buffer = "PLAINTEXT")</span>
|
396
399
|
</a>
|
397
400
|
</div>
|
398
401
|
|
399
402
|
<div class="method-description">
|
400
403
|
<p><a class="source-toggle" href="#"
|
401
|
-
onclick="toggleCode('
|
402
|
-
<div class="method-source-code" id="
|
404
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
405
|
+
<div class="method-source-code" id="M000014-source">
|
403
406
|
<pre>
|
404
407
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 111</span>
|
405
408
|
111: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">encrypt_buffer</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>, <span class="ruby-identifier">buffer</span> = <span class="ruby-value str">"PLAINTEXT"</span>)
|
@@ -411,19 +414,19 @@
|
|
411
414
|
</div>
|
412
415
|
</div>
|
413
416
|
|
414
|
-
<div id="method-
|
415
|
-
<a name="
|
417
|
+
<div id="method-M000016" class="method-detail">
|
418
|
+
<a name="M000016"></a>
|
416
419
|
|
417
420
|
<div class="method-heading">
|
418
|
-
<a href="#
|
421
|
+
<a href="#M000016" class="method-signature">
|
419
422
|
<span class="method-name">encrypt_stream</span><span class="method-args">(keyl, mode, key, iv, sin = STDIN, sout = STDOUT)</span>
|
420
423
|
</a>
|
421
424
|
</div>
|
422
425
|
|
423
426
|
<div class="method-description">
|
424
427
|
<p><a class="source-toggle" href="#"
|
425
|
-
onclick="toggleCode('
|
426
|
-
<div class="method-source-code" id="
|
428
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
429
|
+
<div class="method-source-code" id="M000016-source">
|
427
430
|
<pre>
|
428
431
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 122</span>
|
429
432
|
122: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">encrypt_stream</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>, <span class="ruby-identifier">sin</span> = <span class="ruby-constant">STDIN</span>, <span class="ruby-identifier">sout</span> = <span class="ruby-constant">STDOUT</span>)
|
@@ -438,31 +441,34 @@
|
|
438
441
|
131: <span class="ruby-identifier">sout</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@@aes</span>.<span class="ruby-identifier">encrypt_buffer</span>(<span class="ruby-identifier">sin</span>)
|
439
442
|
132: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">IO</span>
|
440
443
|
133: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">buf</span> = <span class="ruby-identifier">sin</span>.<span class="ruby-identifier">read</span>(<span class="ruby-ivar">@@bs</span>)
|
441
|
-
134:
|
442
|
-
135:
|
443
|
-
136:
|
444
|
-
137:
|
445
|
-
138:
|
446
|
-
139:
|
447
|
-
140:
|
444
|
+
134: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">buf</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@@bs</span>
|
445
|
+
135: <span class="ruby-identifier">sout</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@@aes</span>.<span class="ruby-identifier">encrypt_blocks</span>(<span class="ruby-identifier">buf</span>)
|
446
|
+
136: <span class="ruby-keyword kw">else</span>
|
447
|
+
137: <span class="ruby-identifier">sout</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@@aes</span>.<span class="ruby-identifier">encrypt_buffer</span>(<span class="ruby-identifier">buf</span>)
|
448
|
+
138: <span class="ruby-keyword kw">end</span>
|
449
|
+
139: <span class="ruby-keyword kw">end</span>
|
450
|
+
140: <span class="ruby-keyword kw">else</span>
|
451
|
+
141: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Bad input stream (String, IO)"</span>
|
452
|
+
142: <span class="ruby-keyword kw">end</span>
|
453
|
+
143: <span class="ruby-keyword kw">end</span>
|
448
454
|
</pre>
|
449
455
|
</div>
|
450
456
|
</div>
|
451
457
|
</div>
|
452
458
|
|
453
|
-
<div id="method-
|
454
|
-
<a name="
|
459
|
+
<div id="method-M000011" class="method-detail">
|
460
|
+
<a name="M000011"></a>
|
455
461
|
|
456
462
|
<div class="method-heading">
|
457
|
-
<a href="#
|
463
|
+
<a href="#M000011" class="method-signature">
|
458
464
|
<span class="method-name">init</span><span class="method-args">(keyl, mode, key, iv)</span>
|
459
465
|
</a>
|
460
466
|
</div>
|
461
467
|
|
462
468
|
<div class="method-description">
|
463
469
|
<p><a class="source-toggle" href="#"
|
464
|
-
onclick="toggleCode('
|
465
|
-
<div class="method-source-code" id="
|
470
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
471
|
+
<div class="method-source-code" id="M000011-source">
|
466
472
|
<pre>
|
467
473
|
<span class="ruby-comment cmt"># File lib/ruby-aes.rb, line 90</span>
|
468
474
|
90: <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Aes</span>.<span class="ruby-identifier">init</span>(<span class="ruby-identifier">keyl</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>)
|