ruby-aes-unroll2 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.rb +12 -6
- data/lib/ruby-aes/aes_alg.rb +2 -58
- data/lib/ruby-aes/aes_shared.rb +77 -0
- 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 -968
- data/doc/rdoc/classes/AesCons.html +0 -198
- data/doc/rdoc/files/lib/ruby-aes/aes_alg_rb.html +0 -108
data/examples/encrypt_block.rb
CHANGED
data/examples/encrypt_buffer.rb
CHANGED
data/examples/encrypt_stream.rb
CHANGED
data/lib/ruby-aes.rb
CHANGED
@@ -47,7 +47,7 @@ module Aes
|
|
47
47
|
|
48
48
|
def Aes.check_key(key_string, kl = 128)
|
49
49
|
kl = Aes.check_kl(kl)
|
50
|
-
k = key_string.length
|
50
|
+
k = key_string ? key_string.length : 0
|
51
51
|
raise "Bad key string or bad key length" if (k != kl/8) && (k != kl/4)
|
52
52
|
hex = (key_string =~ /[a-f0-9A-F]{#{k}}/) == 0 && (k == kl/4)
|
53
53
|
bin = ! hex
|
@@ -131,8 +131,11 @@ module Aes
|
|
131
131
|
sout << @@aes.encrypt_buffer(sin)
|
132
132
|
when IO
|
133
133
|
while buf = sin.read(@@bs)
|
134
|
-
|
135
|
-
|
134
|
+
if buf.length == @@bs
|
135
|
+
sout << @@aes.encrypt_blocks(buf)
|
136
|
+
else
|
137
|
+
sout << @@aes.encrypt_buffer(buf)
|
138
|
+
end
|
136
139
|
end
|
137
140
|
else
|
138
141
|
raise "Bad input stream (String, IO)"
|
@@ -150,9 +153,12 @@ module Aes
|
|
150
153
|
when String
|
151
154
|
sout << @@aes.decrypt_buffer(sin)
|
152
155
|
when IO
|
153
|
-
while buf = sin.read(@@bs)
|
154
|
-
|
155
|
-
|
156
|
+
while buf = sin.read(@@bs)#+1)
|
157
|
+
if buf.length == @@bs
|
158
|
+
sout << @@aes.decrypt_blocks(buf)
|
159
|
+
else
|
160
|
+
sout << @@aes.decrypt_buffer(buf)
|
161
|
+
end
|
156
162
|
end
|
157
163
|
else
|
158
164
|
raise "Bad input stream (String, IO)"
|
data/lib/ruby-aes/aes_alg.rb
CHANGED
@@ -12,9 +12,11 @@
|
|
12
12
|
=end
|
13
13
|
|
14
14
|
require 'ruby-aes/aes_cons'
|
15
|
+
require 'ruby-aes/aes_shared'
|
15
16
|
|
16
17
|
class AesAlg
|
17
18
|
include AesCons
|
19
|
+
include AesShared
|
18
20
|
|
19
21
|
def encryption_key_schedule(key)
|
20
22
|
i = 0
|
@@ -504,64 +506,6 @@ class AesAlg
|
|
504
506
|
end
|
505
507
|
end
|
506
508
|
|
507
|
-
def encrypt_blocks(buffer)
|
508
|
-
raise "Bad block length" unless (buffer.length % 16).zero?
|
509
|
-
ct = ""
|
510
|
-
block = ""
|
511
|
-
buffer.each_byte do |char|
|
512
|
-
block << char
|
513
|
-
if block.length == 16
|
514
|
-
ct << encrypt_block(block)
|
515
|
-
block = ""
|
516
|
-
end
|
517
|
-
end
|
518
|
-
end
|
519
|
-
|
520
|
-
def decrypt_blocks(buffer)
|
521
|
-
raise "Bad block length" unless (buffer.length % 16).zero?
|
522
|
-
pt = ""
|
523
|
-
block = ""
|
524
|
-
buffer.each_byte do |char|
|
525
|
-
block << char
|
526
|
-
if block.length == 16
|
527
|
-
pt << decrypt_block(block)
|
528
|
-
block = ""
|
529
|
-
end
|
530
|
-
end
|
531
|
-
end
|
532
|
-
|
533
|
-
def encrypt_buffer(buffer)
|
534
|
-
ct = ""
|
535
|
-
block = ""
|
536
|
-
buffer.each_byte do |char|
|
537
|
-
block << char
|
538
|
-
if block.length == 16
|
539
|
-
ct << encrypt_block(block)
|
540
|
-
block = ""
|
541
|
-
end
|
542
|
-
end
|
543
|
-
m = 16 - block.length % 16
|
544
|
-
ct << (m == 16 ? 0 : encrypt_block(block << m.chr * m))
|
545
|
-
end
|
546
|
-
|
547
|
-
def decrypt_buffer(buffer)
|
548
|
-
pt = ""
|
549
|
-
block = ""
|
550
|
-
buffer.each_byte do |char|
|
551
|
-
block << char
|
552
|
-
if block.length == 16
|
553
|
-
pt << decrypt_block(block)
|
554
|
-
block = ""
|
555
|
-
end
|
556
|
-
end
|
557
|
-
if block.length == 0
|
558
|
-
c = pt[-1]
|
559
|
-
c.chr * c == pt[-c..-1] ? pt[0..-(c+1)] : (raise "Bad Block Padding")
|
560
|
-
else
|
561
|
-
pt
|
562
|
-
end
|
563
|
-
end
|
564
|
-
|
565
509
|
def init(key_length, mode, key, iv = nil)
|
566
510
|
@nb = 4
|
567
511
|
@ek = []
|
@@ -0,0 +1,77 @@
|
|
1
|
+
=begin
|
2
|
+
This file is a part of ruby-aes <http://rubyforge.org/projects/ruby-aes>
|
3
|
+
Written by Alex Boussinet <alex.boussinet@gmail.com>
|
4
|
+
|
5
|
+
It contains the code shared by all the implementations
|
6
|
+
=end
|
7
|
+
|
8
|
+
module AesShared
|
9
|
+
def encrypt_blocks(buffer)
|
10
|
+
raise "Bad block length" unless (buffer.length % 16).zero?
|
11
|
+
ct = ""
|
12
|
+
block = ""
|
13
|
+
buffer.each_byte do |char|
|
14
|
+
block << char
|
15
|
+
if block.length == 16
|
16
|
+
ct << encrypt_block(block)
|
17
|
+
block = ""
|
18
|
+
end
|
19
|
+
end
|
20
|
+
ct
|
21
|
+
end
|
22
|
+
|
23
|
+
def decrypt_blocks(buffer)
|
24
|
+
raise "Bad block length" unless (buffer.length % 16).zero?
|
25
|
+
pt = ""
|
26
|
+
block = ""
|
27
|
+
buffer.each_byte do |char|
|
28
|
+
block << char
|
29
|
+
if block.length == 16
|
30
|
+
pt << decrypt_block(block)
|
31
|
+
block = ""
|
32
|
+
end
|
33
|
+
end
|
34
|
+
pt
|
35
|
+
end
|
36
|
+
|
37
|
+
def encrypt_buffer(buffer)
|
38
|
+
ct = ""
|
39
|
+
block = ""
|
40
|
+
buffer.each_byte do |char|
|
41
|
+
block << char
|
42
|
+
if block.length == 16
|
43
|
+
ct << encrypt_block(block)
|
44
|
+
block = ""
|
45
|
+
end
|
46
|
+
end
|
47
|
+
c = "\000"
|
48
|
+
if (m = 16 - block.length % 16) != 16
|
49
|
+
c = m.chr
|
50
|
+
ct << encrypt_block(block << c * m)
|
51
|
+
end
|
52
|
+
ct << c
|
53
|
+
end
|
54
|
+
|
55
|
+
def decrypt_buffer(buffer)
|
56
|
+
pt = ""
|
57
|
+
block = ""
|
58
|
+
buffer.each_byte do |char|
|
59
|
+
block << char
|
60
|
+
if block.length == 16
|
61
|
+
pt << decrypt_block(block)
|
62
|
+
block = ""
|
63
|
+
end
|
64
|
+
end
|
65
|
+
if block.length != 1
|
66
|
+
raise 'Bad Block Padding'
|
67
|
+
elsif (c = block[-1]).zero?
|
68
|
+
pt
|
69
|
+
else
|
70
|
+
if block * c == pt[-c..-1]
|
71
|
+
pt[0..-c-1]
|
72
|
+
else
|
73
|
+
raise "Bad Block Padding"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -3,8 +3,10 @@ require File.dirname(__FILE__) + '/../lib/ruby-aes'
|
|
3
3
|
|
4
4
|
require 'fileutils'
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
unless defined? KEY_LENGTH
|
7
|
+
KEY_LENGTH = [128,192,256].freeze
|
8
|
+
MODES = ['ECB','CBC','OFB','CFB'].freeze
|
9
|
+
end
|
8
10
|
|
9
11
|
def random_fill(n, buffer)
|
10
12
|
n.times do
|
data/test/test_ruby-aes.rb
CHANGED
@@ -13,24 +13,28 @@ class TestRubyAES < Test::Unit::TestCase
|
|
13
13
|
random_fill(16, @iv)
|
14
14
|
@pt = ""
|
15
15
|
random_fill(64, @pt)
|
16
|
-
@kl = KEY_LENGTH[(rand * KEY_LENGTH).to_i]
|
16
|
+
@kl = KEY_LENGTH[(rand * KEY_LENGTH.length).to_i]
|
17
17
|
@mode = MODES[(rand * MODES.length).to_i]
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_modes_and_key_lengths
|
21
|
+
pt = @pt[0...16]
|
21
22
|
MODES.each do |mode|
|
22
23
|
KEY_LENGTH.each do |kl|
|
23
|
-
ct = Aes.encrypt_block(kl, mode, @keys[kl], @iv,
|
24
|
+
ct = Aes.encrypt_block(kl, mode, @keys[kl], @iv, pt)
|
24
25
|
npt = Aes.decrypt_block(kl, mode, @keys[kl], @iv, ct)
|
25
|
-
assert_equal(
|
26
|
+
assert_equal(pt, npt, "Error in encryption/decryption (#{kl}-#{mode})")
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
def
|
31
|
+
def test_encrypt_decrypt_stream
|
31
32
|
file = "_ruby-aes_test_encrypt_stream_"
|
32
33
|
sin = File.open(file, "w+b")
|
33
34
|
random_fill(4242, sin)
|
35
|
+
sin.close
|
36
|
+
|
37
|
+
sin = File.open(file, "rb")
|
34
38
|
sout = File.open("#{file}.aes", "w+b")
|
35
39
|
Aes.encrypt_stream(@kl, @mode, @keys[@kl], @iv, sin, sout)
|
36
40
|
sin.close
|
@@ -42,18 +46,27 @@ class TestRubyAES < Test::Unit::TestCase
|
|
42
46
|
sin.close
|
43
47
|
sout.close
|
44
48
|
|
45
|
-
|
46
|
-
|
49
|
+
pt, npt = IO.read(file), IO.read("#{file}.plain")
|
50
|
+
|
51
|
+
assert_equal pt, npt, "Error in encrypt_decrypt_stream"
|
52
|
+
ensure
|
47
53
|
FileUtils.rm_f [ file, "#{file}.aes", "#{file}.plain" ]
|
48
54
|
end
|
49
55
|
|
50
|
-
def
|
56
|
+
def test_encrypt_decrypt_buffer
|
57
|
+
MODES.each do |mode|
|
58
|
+
KEY_LENGTH.each do |kl|
|
59
|
+
ct = Aes.encrypt_buffer(kl, mode, @keys[kl], @iv, @pt)
|
60
|
+
npt = Aes.decrypt_buffer(kl, mode, @keys[kl], @iv, ct)
|
61
|
+
assert_equal(@pt, npt, "Error in encrypt_decrypt_buffer")
|
62
|
+
end
|
63
|
+
end
|
51
64
|
pt = ""
|
52
65
|
42.times do
|
53
66
|
pt << random_fill(1, pt)
|
54
67
|
ct = Aes.encrypt_buffer(@kl, @mode, @keys[@kl], @iv, pt)
|
55
68
|
npt = Aes.decrypt_buffer(@kl, @mode, @keys[@kl], @iv, ct)
|
56
|
-
assert_equal(pt, npt, "Error in
|
69
|
+
assert_equal(pt, npt, "Error in encrypt_decrypt_buffer")
|
57
70
|
end
|
58
71
|
end
|
59
72
|
|
@@ -79,19 +92,19 @@ class TestRubyAES < Test::Unit::TestCase
|
|
79
92
|
|
80
93
|
def test_check_key
|
81
94
|
assert_raise(RuntimeError) do
|
82
|
-
Aes.check_key(@
|
95
|
+
Aes.check_key(@keys[128], 64)
|
83
96
|
end # bad key length
|
84
97
|
assert_raise(RuntimeError) do
|
85
98
|
Aes.check_key('123', 128)
|
86
99
|
end # bad key string
|
87
100
|
assert_raise(RuntimeError) do
|
88
|
-
Aes.check_key(
|
101
|
+
Aes.check_key(nil, 256)
|
89
102
|
end # bad key string
|
90
103
|
assert_raise(RuntimeError) do
|
91
|
-
Aes.check_key(@
|
104
|
+
Aes.check_key(@keys[128].unpack('H*'), 128)
|
92
105
|
end # bad key string
|
93
106
|
assert_nothing_raised do
|
94
|
-
Aes.check_key(@
|
107
|
+
Aes.check_key(@keys[@kl], @kl)
|
95
108
|
end
|
96
109
|
end
|
97
110
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-aes-unroll2
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "1.
|
7
|
-
date:
|
6
|
+
version: "1.1"
|
7
|
+
date: 2008-01-05 00:00:00 +01:00
|
8
8
|
summary: ruby-aes is an implementation of the Rijndael algorithm (AES)
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -35,6 +35,13 @@ files:
|
|
35
35
|
- Rakefile
|
36
36
|
- doc/rdoc
|
37
37
|
- doc/rdoc/files
|
38
|
+
- doc/rdoc/files/lib
|
39
|
+
- doc/rdoc/files/lib/ruby-aes_rb.html
|
40
|
+
- doc/rdoc/files/lib/ruby-aes
|
41
|
+
- doc/rdoc/files/lib/ruby-aes/aes_shared_rb.html
|
42
|
+
- doc/rdoc/files/CHANGELOG.html
|
43
|
+
- doc/rdoc/files/README.html
|
44
|
+
- doc/rdoc/files/COPYING.html
|
38
45
|
- doc/rdoc/index.html
|
39
46
|
- doc/rdoc/rdoc-style.css
|
40
47
|
- doc/rdoc/fr_method_index.html
|
@@ -42,25 +49,15 @@ files:
|
|
42
49
|
- doc/rdoc/fr_file_index.html
|
43
50
|
- doc/rdoc/created.rid
|
44
51
|
- doc/rdoc/classes
|
45
|
-
- doc/rdoc/files/lib
|
46
|
-
- doc/rdoc/files/CHANGELOG.html
|
47
|
-
- doc/rdoc/files/README.html
|
48
|
-
- doc/rdoc/files/COPYING.html
|
49
|
-
- doc/rdoc/files/lib/ruby-aes_rb.html
|
50
|
-
- doc/rdoc/files/lib/ruby-aes
|
51
|
-
- doc/rdoc/files/lib/ruby-aes/aes_cons_rb.html
|
52
|
-
- doc/rdoc/files/lib/ruby-aes/aes_alg_rb.html
|
53
|
-
- doc/rdoc/classes/AesAlg.html
|
54
52
|
- doc/rdoc/classes/Aes.html
|
55
|
-
- doc/rdoc/classes/
|
53
|
+
- doc/rdoc/classes/AesShared.html
|
56
54
|
- examples/encrypt_block.rb
|
57
55
|
- examples/example_helper.rb
|
58
56
|
- examples/encrypt_stream.rb
|
59
57
|
- examples/encrypt_buffer.rb
|
60
58
|
- lib/ruby-aes
|
59
|
+
- lib/ruby-aes/aes_shared.rb
|
61
60
|
- lib/ruby-aes.rb
|
62
|
-
- lib/ruby-aes/aes_alg.rb
|
63
|
-
- lib/ruby-aes/aes_cons.rb
|
64
61
|
- test/test_ruby-aes.rb
|
65
62
|
- test/test_helper.rb
|
66
63
|
- test/KAT_MCT
|
@@ -69,6 +66,8 @@ files:
|
|
69
66
|
- test/KAT_MCT/table.192
|
70
67
|
- test/KAT_MCT/table.256
|
71
68
|
- test/KAT_MCT/aes_kat_mct.rb
|
69
|
+
- lib/ruby-aes/aes_alg.rb
|
70
|
+
- lib/ruby-aes/aes_cons.rb
|
72
71
|
test_files:
|
73
72
|
- test/test_ruby-aes.rb
|
74
73
|
- test/test_helper.rb
|
@@ -1,968 +0,0 @@
|
|
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>Class: AesAlg</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="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">AesAlg</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/ruby-aes/aes_alg_rb.html">
|
59
|
-
lib/ruby-aes/aes_alg.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="method-list">
|
86
|
-
<h3 class="section-bar">Methods</h3>
|
87
|
-
|
88
|
-
<div class="name-list">
|
89
|
-
<a href="#M000004">_decrypt_block</a>
|
90
|
-
<a href="#M000003">_encrypt_block</a>
|
91
|
-
<a href="#M000007">decrypt_block</a>
|
92
|
-
<a href="#M000009">decrypt_blocks</a>
|
93
|
-
<a href="#M000011">decrypt_buffer</a>
|
94
|
-
<a href="#M000002">decryption_key_schedule</a>
|
95
|
-
<a href="#M000006">encrypt_block</a>
|
96
|
-
<a href="#M000008">encrypt_blocks</a>
|
97
|
-
<a href="#M000010">encrypt_buffer</a>
|
98
|
-
<a href="#M000001">encryption_key_schedule</a>
|
99
|
-
<a href="#M000012">init</a>
|
100
|
-
<a href="#M000013">new</a>
|
101
|
-
<a href="#M000005">xor</a>
|
102
|
-
</div>
|
103
|
-
</div>
|
104
|
-
|
105
|
-
</div>
|
106
|
-
|
107
|
-
|
108
|
-
<!-- if includes -->
|
109
|
-
<div id="includes">
|
110
|
-
<h3 class="section-bar">Included Modules</h3>
|
111
|
-
|
112
|
-
<div id="includes-list">
|
113
|
-
<span class="include-name"><a href="AesCons.html">AesCons</a></span>
|
114
|
-
</div>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<div id="section">
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
<!-- if method_list -->
|
127
|
-
<div id="methods">
|
128
|
-
<h3 class="section-bar">Public Class methods</h3>
|
129
|
-
|
130
|
-
<div id="method-M000013" class="method-detail">
|
131
|
-
<a name="M000013"></a>
|
132
|
-
|
133
|
-
<div class="method-heading">
|
134
|
-
<a href="#M000013" class="method-signature">
|
135
|
-
<span class="method-name">new</span><span class="method-args">(key_length, mode, key, iv = nil)</span>
|
136
|
-
</a>
|
137
|
-
</div>
|
138
|
-
|
139
|
-
<div class="method-description">
|
140
|
-
<p><a class="source-toggle" href="#"
|
141
|
-
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
142
|
-
<div class="method-source-code" id="M000013-source">
|
143
|
-
<pre>
|
144
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 595</span>
|
145
|
-
595: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">key_length</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span> = <span class="ruby-keyword kw">nil</span>)
|
146
|
-
596: <span class="ruby-identifier">init</span>(<span class="ruby-identifier">key_length</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span>)
|
147
|
-
597: <span class="ruby-keyword kw">end</span>
|
148
|
-
</pre>
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
</div>
|
152
|
-
|
153
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
154
|
-
|
155
|
-
<div id="method-M000007" class="method-detail">
|
156
|
-
<a name="M000007"></a>
|
157
|
-
|
158
|
-
<div class="method-heading">
|
159
|
-
<a href="#M000007" class="method-signature">
|
160
|
-
<span class="method-name">decrypt_block</span><span class="method-args">(block)</span>
|
161
|
-
</a>
|
162
|
-
</div>
|
163
|
-
|
164
|
-
<div class="method-description">
|
165
|
-
<p><a class="source-toggle" href="#"
|
166
|
-
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
167
|
-
<div class="method-source-code" id="M000007-source">
|
168
|
-
<pre>
|
169
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 489</span>
|
170
|
-
489: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decrypt_block</span>(<span class="ruby-identifier">block</span>)
|
171
|
-
490: <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@mode</span>
|
172
|
-
491: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'ECB'</span>
|
173
|
-
492: <span class="ruby-identifier">_decrypt_block</span>(<span class="ruby-identifier">block</span>)
|
174
|
-
493: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'CBC'</span>
|
175
|
-
494: <span class="ruby-identifier">o</span> = <span class="ruby-identifier">xor</span>(<span class="ruby-identifier">_decrypt_block</span>(<span class="ruby-identifier">block</span>), <span class="ruby-ivar">@iv</span>)
|
176
|
-
495: <span class="ruby-ivar">@iv</span> = <span class="ruby-identifier">block</span>
|
177
|
-
496: <span class="ruby-identifier">o</span>
|
178
|
-
497: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'OFB'</span>
|
179
|
-
498: <span class="ruby-ivar">@iv</span> = <span class="ruby-identifier">_encrypt_block</span>(<span class="ruby-ivar">@iv</span>)
|
180
|
-
499: <span class="ruby-identifier">xor</span>(<span class="ruby-ivar">@iv</span>, <span class="ruby-identifier">block</span>)
|
181
|
-
500: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'CFB'</span>
|
182
|
-
501: <span class="ruby-identifier">o</span> = <span class="ruby-identifier">xor</span>(<span class="ruby-identifier">_encrypt_block</span>(<span class="ruby-ivar">@iv</span>), <span class="ruby-identifier">block</span>)
|
183
|
-
502: <span class="ruby-ivar">@iv</span> = <span class="ruby-identifier">block</span>
|
184
|
-
503: <span class="ruby-identifier">o</span>
|
185
|
-
504: <span class="ruby-keyword kw">end</span>
|
186
|
-
505: <span class="ruby-keyword kw">end</span>
|
187
|
-
</pre>
|
188
|
-
</div>
|
189
|
-
</div>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<div id="method-M000009" class="method-detail">
|
193
|
-
<a name="M000009"></a>
|
194
|
-
|
195
|
-
<div class="method-heading">
|
196
|
-
<a href="#M000009" class="method-signature">
|
197
|
-
<span class="method-name">decrypt_blocks</span><span class="method-args">(buffer)</span>
|
198
|
-
</a>
|
199
|
-
</div>
|
200
|
-
|
201
|
-
<div class="method-description">
|
202
|
-
<p><a class="source-toggle" href="#"
|
203
|
-
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
204
|
-
<div class="method-source-code" id="M000009-source">
|
205
|
-
<pre>
|
206
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 520</span>
|
207
|
-
520: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decrypt_blocks</span>(<span class="ruby-identifier">buffer</span>)
|
208
|
-
521: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Bad block length"</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">%</span> <span class="ruby-value">16</span>).<span class="ruby-identifier">zero?</span>
|
209
|
-
522: <span class="ruby-identifier">pt</span> = <span class="ruby-value str">""</span>
|
210
|
-
523: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
211
|
-
524: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">each_byte</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span><span class="ruby-operator">|</span>
|
212
|
-
525: <span class="ruby-identifier">block</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">char</span>
|
213
|
-
526: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">16</span>
|
214
|
-
527: <span class="ruby-identifier">pt</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">decrypt_block</span>(<span class="ruby-identifier">block</span>)
|
215
|
-
528: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
216
|
-
529: <span class="ruby-keyword kw">end</span>
|
217
|
-
530: <span class="ruby-keyword kw">end</span>
|
218
|
-
531: <span class="ruby-keyword kw">end</span>
|
219
|
-
</pre>
|
220
|
-
</div>
|
221
|
-
</div>
|
222
|
-
</div>
|
223
|
-
|
224
|
-
<div id="method-M000011" class="method-detail">
|
225
|
-
<a name="M000011"></a>
|
226
|
-
|
227
|
-
<div class="method-heading">
|
228
|
-
<a href="#M000011" class="method-signature">
|
229
|
-
<span class="method-name">decrypt_buffer</span><span class="method-args">(buffer)</span>
|
230
|
-
</a>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
<div class="method-description">
|
234
|
-
<p><a class="source-toggle" href="#"
|
235
|
-
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
236
|
-
<div class="method-source-code" id="M000011-source">
|
237
|
-
<pre>
|
238
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 547</span>
|
239
|
-
547: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decrypt_buffer</span>(<span class="ruby-identifier">buffer</span>)
|
240
|
-
548: <span class="ruby-identifier">pt</span> = <span class="ruby-value str">""</span>
|
241
|
-
549: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
242
|
-
550: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">each_byte</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span><span class="ruby-operator">|</span>
|
243
|
-
551: <span class="ruby-identifier">block</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">char</span>
|
244
|
-
552: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">16</span>
|
245
|
-
553: <span class="ruby-identifier">pt</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">decrypt_block</span>(<span class="ruby-identifier">block</span>)
|
246
|
-
554: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
247
|
-
555: <span class="ruby-keyword kw">end</span>
|
248
|
-
556: <span class="ruby-keyword kw">end</span>
|
249
|
-
557: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
250
|
-
558: <span class="ruby-identifier">c</span> = <span class="ruby-identifier">pt</span>[<span class="ruby-value">-1</span>]
|
251
|
-
559: <span class="ruby-identifier">c</span>.<span class="ruby-identifier">chr</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">pt</span>[<span class="ruby-operator">-</span><span class="ruby-identifier">c</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">pt</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-operator">-</span>(<span class="ruby-identifier">c</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)] <span class="ruby-operator">:</span> (<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Bad Block Padding"</span>)
|
252
|
-
560: <span class="ruby-keyword kw">else</span>
|
253
|
-
561: <span class="ruby-identifier">pt</span>
|
254
|
-
562: <span class="ruby-keyword kw">end</span>
|
255
|
-
563: <span class="ruby-keyword kw">end</span>
|
256
|
-
</pre>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
</div>
|
260
|
-
|
261
|
-
<div id="method-M000006" class="method-detail">
|
262
|
-
<a name="M000006"></a>
|
263
|
-
|
264
|
-
<div class="method-heading">
|
265
|
-
<a href="#M000006" class="method-signature">
|
266
|
-
<span class="method-name">encrypt_block</span><span class="method-args">(block)</span>
|
267
|
-
</a>
|
268
|
-
</div>
|
269
|
-
|
270
|
-
<div class="method-description">
|
271
|
-
<p><a class="source-toggle" href="#"
|
272
|
-
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
273
|
-
<div class="method-source-code" id="M000006-source">
|
274
|
-
<pre>
|
275
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 475</span>
|
276
|
-
475: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encrypt_block</span>(<span class="ruby-identifier">block</span>)
|
277
|
-
476: <span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@mode</span>
|
278
|
-
477: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'ECB'</span>
|
279
|
-
478: <span class="ruby-identifier">_encrypt_block</span>(<span class="ruby-identifier">block</span>)
|
280
|
-
479: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'CBC'</span>
|
281
|
-
480: <span class="ruby-ivar">@iv</span> = <span class="ruby-identifier">_encrypt_block</span>(<span class="ruby-identifier">xor</span>(<span class="ruby-identifier">block</span>, <span class="ruby-ivar">@iv</span>))
|
282
|
-
481: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'OFB'</span>
|
283
|
-
482: <span class="ruby-ivar">@iv</span> = <span class="ruby-identifier">_encrypt_block</span>(<span class="ruby-ivar">@iv</span>)
|
284
|
-
483: <span class="ruby-identifier">xor</span>(<span class="ruby-ivar">@iv</span>, <span class="ruby-identifier">block</span>)
|
285
|
-
484: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'CFB'</span>
|
286
|
-
485: <span class="ruby-ivar">@iv</span> = <span class="ruby-identifier">xor</span>(<span class="ruby-identifier">_encrypt_block</span>(<span class="ruby-ivar">@iv</span>), <span class="ruby-identifier">block</span>)
|
287
|
-
486: <span class="ruby-keyword kw">end</span>
|
288
|
-
487: <span class="ruby-keyword kw">end</span>
|
289
|
-
</pre>
|
290
|
-
</div>
|
291
|
-
</div>
|
292
|
-
</div>
|
293
|
-
|
294
|
-
<div id="method-M000008" class="method-detail">
|
295
|
-
<a name="M000008"></a>
|
296
|
-
|
297
|
-
<div class="method-heading">
|
298
|
-
<a href="#M000008" class="method-signature">
|
299
|
-
<span class="method-name">encrypt_blocks</span><span class="method-args">(buffer)</span>
|
300
|
-
</a>
|
301
|
-
</div>
|
302
|
-
|
303
|
-
<div class="method-description">
|
304
|
-
<p><a class="source-toggle" href="#"
|
305
|
-
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
306
|
-
<div class="method-source-code" id="M000008-source">
|
307
|
-
<pre>
|
308
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 507</span>
|
309
|
-
507: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encrypt_blocks</span>(<span class="ruby-identifier">buffer</span>)
|
310
|
-
508: <span class="ruby-identifier">raise</span> <span class="ruby-value str">"Bad block length"</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">%</span> <span class="ruby-value">16</span>).<span class="ruby-identifier">zero?</span>
|
311
|
-
509: <span class="ruby-identifier">ct</span> = <span class="ruby-value str">""</span>
|
312
|
-
510: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
313
|
-
511: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">each_byte</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span><span class="ruby-operator">|</span>
|
314
|
-
512: <span class="ruby-identifier">block</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">char</span>
|
315
|
-
513: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">16</span>
|
316
|
-
514: <span class="ruby-identifier">ct</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encrypt_block</span>(<span class="ruby-identifier">block</span>)
|
317
|
-
515: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
318
|
-
516: <span class="ruby-keyword kw">end</span>
|
319
|
-
517: <span class="ruby-keyword kw">end</span>
|
320
|
-
518: <span class="ruby-keyword kw">end</span>
|
321
|
-
</pre>
|
322
|
-
</div>
|
323
|
-
</div>
|
324
|
-
</div>
|
325
|
-
|
326
|
-
<div id="method-M000010" class="method-detail">
|
327
|
-
<a name="M000010"></a>
|
328
|
-
|
329
|
-
<div class="method-heading">
|
330
|
-
<a href="#M000010" class="method-signature">
|
331
|
-
<span class="method-name">encrypt_buffer</span><span class="method-args">(buffer)</span>
|
332
|
-
</a>
|
333
|
-
</div>
|
334
|
-
|
335
|
-
<div class="method-description">
|
336
|
-
<p><a class="source-toggle" href="#"
|
337
|
-
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
338
|
-
<div class="method-source-code" id="M000010-source">
|
339
|
-
<pre>
|
340
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 533</span>
|
341
|
-
533: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encrypt_buffer</span>(<span class="ruby-identifier">buffer</span>)
|
342
|
-
534: <span class="ruby-identifier">ct</span> = <span class="ruby-value str">""</span>
|
343
|
-
535: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
344
|
-
536: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">each_byte</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span><span class="ruby-operator">|</span>
|
345
|
-
537: <span class="ruby-identifier">block</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">char</span>
|
346
|
-
538: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">16</span>
|
347
|
-
539: <span class="ruby-identifier">ct</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encrypt_block</span>(<span class="ruby-identifier">block</span>)
|
348
|
-
540: <span class="ruby-identifier">block</span> = <span class="ruby-value str">""</span>
|
349
|
-
541: <span class="ruby-keyword kw">end</span>
|
350
|
-
542: <span class="ruby-keyword kw">end</span>
|
351
|
-
543: <span class="ruby-identifier">m</span> = <span class="ruby-value">16</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">%</span> <span class="ruby-value">16</span>
|
352
|
-
544: <span class="ruby-identifier">ct</span> <span class="ruby-operator"><<</span> (<span class="ruby-identifier">m</span> <span class="ruby-operator">==</span> <span class="ruby-value">16</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">encrypt_block</span>(<span class="ruby-identifier">block</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">chr</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">m</span>))
|
353
|
-
545: <span class="ruby-keyword kw">end</span>
|
354
|
-
</pre>
|
355
|
-
</div>
|
356
|
-
</div>
|
357
|
-
</div>
|
358
|
-
|
359
|
-
<div id="method-M000012" class="method-detail">
|
360
|
-
<a name="M000012"></a>
|
361
|
-
|
362
|
-
<div class="method-heading">
|
363
|
-
<a href="#M000012" class="method-signature">
|
364
|
-
<span class="method-name">init</span><span class="method-args">(key_length, mode, key, iv = nil)</span>
|
365
|
-
</a>
|
366
|
-
</div>
|
367
|
-
|
368
|
-
<div class="method-description">
|
369
|
-
<p><a class="source-toggle" href="#"
|
370
|
-
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
371
|
-
<div class="method-source-code" id="M000012-source">
|
372
|
-
<pre>
|
373
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 565</span>
|
374
|
-
565: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init</span>(<span class="ruby-identifier">key_length</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">iv</span> = <span class="ruby-keyword kw">nil</span>)
|
375
|
-
566: <span class="ruby-ivar">@nb</span> = <span class="ruby-value">4</span>
|
376
|
-
567: <span class="ruby-ivar">@ek</span> = []
|
377
|
-
568: <span class="ruby-ivar">@dk</span> = []
|
378
|
-
569: <span class="ruby-ivar">@state</span> = <span class="ruby-keyword kw">nil</span>
|
379
|
-
570: <span class="ruby-ivar">@iv</span> = <span class="ruby-value str">"\000"</span> <span class="ruby-operator">*</span> <span class="ruby-value">16</span>
|
380
|
-
571: <span class="ruby-ivar">@iv</span> = <span class="ruby-identifier">iv</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">iv</span>
|
381
|
-
572: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">key_length</span>
|
382
|
-
573: <span class="ruby-keyword kw">when</span> <span class="ruby-value">128</span>
|
383
|
-
574: <span class="ruby-ivar">@nk</span> = <span class="ruby-value">4</span>
|
384
|
-
575: <span class="ruby-ivar">@nr</span> = <span class="ruby-value">10</span>
|
385
|
-
576: <span class="ruby-keyword kw">when</span> <span class="ruby-value">192</span>
|
386
|
-
577: <span class="ruby-ivar">@nk</span> = <span class="ruby-value">6</span>
|
387
|
-
578: <span class="ruby-ivar">@nr</span> = <span class="ruby-value">12</span>
|
388
|
-
579: <span class="ruby-keyword kw">when</span> <span class="ruby-value">256</span>
|
389
|
-
580: <span class="ruby-ivar">@nk</span> = <span class="ruby-value">8</span>
|
390
|
-
581: <span class="ruby-ivar">@nr</span> = <span class="ruby-value">14</span>
|
391
|
-
582: <span class="ruby-keyword kw">else</span>
|
392
|
-
583: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Bad Key length'</span>
|
393
|
-
584: <span class="ruby-keyword kw">end</span>
|
394
|
-
585: <span class="ruby-ivar">@kl</span> = <span class="ruby-identifier">key_length</span>
|
395
|
-
586: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">mode</span>
|
396
|
-
587: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">'ECB'</span>, <span class="ruby-value str">'CBC'</span>, <span class="ruby-value str">'OFB'</span>, <span class="ruby-value str">'CFB'</span>
|
397
|
-
588: <span class="ruby-ivar">@mode</span> = <span class="ruby-identifier">mode</span>
|
398
|
-
589: <span class="ruby-keyword kw">else</span>
|
399
|
-
590: <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Bad AES mode'</span>
|
400
|
-
591: <span class="ruby-keyword kw">end</span>
|
401
|
-
592: <span class="ruby-identifier">decryption_key_schedule</span>(<span class="ruby-identifier">key</span>)
|
402
|
-
593: <span class="ruby-keyword kw">end</span>
|
403
|
-
</pre>
|
404
|
-
</div>
|
405
|
-
</div>
|
406
|
-
</div>
|
407
|
-
|
408
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
409
|
-
|
410
|
-
<div id="method-M000004" class="method-detail">
|
411
|
-
<a name="M000004"></a>
|
412
|
-
|
413
|
-
<div class="method-heading">
|
414
|
-
<a href="#M000004" class="method-signature">
|
415
|
-
<span class="method-name">_decrypt_block</span><span class="method-args">(ct)</span>
|
416
|
-
</a>
|
417
|
-
</div>
|
418
|
-
|
419
|
-
<div class="method-description">
|
420
|
-
<p><a class="source-toggle" href="#"
|
421
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
422
|
-
<div class="method-source-code" id="M000004-source">
|
423
|
-
<pre>
|
424
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 309</span>
|
425
|
-
309: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_decrypt_block</span>(<span class="ruby-identifier">ct</span>)
|
426
|
-
310: <span class="ruby-comment cmt">#</span>
|
427
|
-
311: <span class="ruby-comment cmt"># map byte array block to cipher state and add initial round key:</span>
|
428
|
-
312: <span class="ruby-comment cmt">#</span>
|
429
|
-
313: <span class="ruby-identifier">s0</span> = (<span class="ruby-identifier">ct</span>[ <span class="ruby-value">0</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[ <span class="ruby-value">1</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[ <span class="ruby-value">2</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[ <span class="ruby-value">3</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">0</span>]
|
430
|
-
314: <span class="ruby-identifier">s1</span> = (<span class="ruby-identifier">ct</span>[ <span class="ruby-value">4</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[ <span class="ruby-value">5</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[ <span class="ruby-value">6</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[ <span class="ruby-value">7</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">1</span>]
|
431
|
-
315: <span class="ruby-identifier">s2</span> = (<span class="ruby-identifier">ct</span>[ <span class="ruby-value">8</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[ <span class="ruby-value">9</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[<span class="ruby-value">10</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[<span class="ruby-value">11</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">2</span>]
|
432
|
-
316: <span class="ruby-identifier">s3</span> = (<span class="ruby-identifier">ct</span>[<span class="ruby-value">12</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[<span class="ruby-value">13</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[<span class="ruby-value">14</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">ct</span>[<span class="ruby-value">15</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">3</span>]
|
433
|
-
317: <span class="ruby-comment cmt"># round 1:</span>
|
434
|
-
318: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
435
|
-
319: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[ <span class="ruby-value">4</span>]
|
436
|
-
320: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
437
|
-
321: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[ <span class="ruby-value">5</span>]
|
438
|
-
322: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
439
|
-
323: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[ <span class="ruby-value">6</span>]
|
440
|
-
324: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
441
|
-
325: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[ <span class="ruby-value">7</span>]
|
442
|
-
326: <span class="ruby-comment cmt"># round 2:</span>
|
443
|
-
327: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
444
|
-
328: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[ <span class="ruby-value">8</span>]
|
445
|
-
329: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
446
|
-
330: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[ <span class="ruby-value">9</span>]
|
447
|
-
331: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
448
|
-
332: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">10</span>]
|
449
|
-
333: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
450
|
-
334: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">11</span>]
|
451
|
-
335: <span class="ruby-comment cmt"># round 3:</span>
|
452
|
-
336: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
453
|
-
337: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">12</span>]
|
454
|
-
338: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
455
|
-
339: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">13</span>]
|
456
|
-
340: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
457
|
-
341: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">14</span>]
|
458
|
-
342: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
459
|
-
343: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">15</span>]
|
460
|
-
344: <span class="ruby-comment cmt"># round 4:</span>
|
461
|
-
345: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
462
|
-
346: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">16</span>]
|
463
|
-
347: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
464
|
-
348: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">17</span>]
|
465
|
-
349: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
466
|
-
350: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">18</span>]
|
467
|
-
351: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
468
|
-
352: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">19</span>]
|
469
|
-
353: <span class="ruby-comment cmt"># round 5:</span>
|
470
|
-
354: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
471
|
-
355: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">20</span>]
|
472
|
-
356: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
473
|
-
357: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">21</span>]
|
474
|
-
358: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
475
|
-
359: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">22</span>]
|
476
|
-
360: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
477
|
-
361: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">23</span>]
|
478
|
-
362: <span class="ruby-comment cmt"># round 6:</span>
|
479
|
-
363: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
480
|
-
364: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">24</span>]
|
481
|
-
365: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
482
|
-
366: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">25</span>]
|
483
|
-
367: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
484
|
-
368: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">26</span>]
|
485
|
-
369: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
486
|
-
370: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">27</span>]
|
487
|
-
371: <span class="ruby-comment cmt"># round 7:</span>
|
488
|
-
372: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
489
|
-
373: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">28</span>]
|
490
|
-
374: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
491
|
-
375: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">29</span>]
|
492
|
-
376: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
493
|
-
377: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">30</span>]
|
494
|
-
378: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
495
|
-
379: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">31</span>]
|
496
|
-
380: <span class="ruby-comment cmt"># round 8:</span>
|
497
|
-
381: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
498
|
-
382: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">32</span>]
|
499
|
-
383: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
500
|
-
384: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">33</span>]
|
501
|
-
385: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
502
|
-
386: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">34</span>]
|
503
|
-
387: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
504
|
-
388: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">35</span>]
|
505
|
-
389: <span class="ruby-comment cmt"># round 9:</span>
|
506
|
-
390: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
507
|
-
391: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">36</span>]
|
508
|
-
392: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
509
|
-
393: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">37</span>]
|
510
|
-
394: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
511
|
-
395: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">38</span>]
|
512
|
-
396: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
513
|
-
397: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">39</span>]
|
514
|
-
398: <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@nr</span> <span class="ruby-operator">></span> <span class="ruby-value">10</span>)
|
515
|
-
399: <span class="ruby-comment cmt"># round 10:</span>
|
516
|
-
400: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
517
|
-
401: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">40</span>]
|
518
|
-
402: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
519
|
-
403: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">41</span>]
|
520
|
-
404: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
521
|
-
405: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">42</span>]
|
522
|
-
406: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
523
|
-
407: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">43</span>]
|
524
|
-
408: <span class="ruby-comment cmt"># round 11:</span>
|
525
|
-
409: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
526
|
-
410: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">44</span>]
|
527
|
-
411: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
528
|
-
412: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">45</span>]
|
529
|
-
413: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
530
|
-
414: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">46</span>]
|
531
|
-
415: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
532
|
-
416: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">47</span>]
|
533
|
-
417: <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@nr</span> <span class="ruby-operator">></span> <span class="ruby-value">12</span>)
|
534
|
-
418: <span class="ruby-comment cmt"># round 12:</span>
|
535
|
-
419: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
536
|
-
420: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">48</span>]
|
537
|
-
421: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
538
|
-
422: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">49</span>]
|
539
|
-
423: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
540
|
-
424: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">50</span>]
|
541
|
-
425: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
542
|
-
426: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">51</span>]
|
543
|
-
427: <span class="ruby-comment cmt"># round 13:</span>
|
544
|
-
428: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
545
|
-
429: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">52</span>]
|
546
|
-
430: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
547
|
-
431: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">53</span>]
|
548
|
-
432: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
549
|
-
433: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">54</span>]
|
550
|
-
434: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Td0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
551
|
-
435: <span class="ruby-constant">Td2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Td3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">55</span>]
|
552
|
-
436: <span class="ruby-keyword kw">end</span>
|
553
|
-
437: <span class="ruby-keyword kw">end</span>
|
554
|
-
438: <span class="ruby-identifier">j</span> = <span class="ruby-ivar">@nr</span> <span class="ruby-operator"><<</span> <span class="ruby-value">2</span>
|
555
|
-
439: <span class="ruby-comment cmt">#</span>
|
556
|
-
440: <span class="ruby-comment cmt"># apply last round and map cipher state to byte array block:</span>
|
557
|
-
441: <span class="ruby-comment cmt">#</span>
|
558
|
-
442: <span class="ruby-identifier">s0</span> =
|
559
|
-
443: (<span class="ruby-constant">Si3</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
560
|
-
444: (<span class="ruby-constant">Si2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
561
|
-
445: (<span class="ruby-constant">Si1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
562
|
-
446: (<span class="ruby-constant">Si0</span>[(<span class="ruby-identifier">t1</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">0</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
563
|
-
447: <span class="ruby-identifier">s1</span> =
|
564
|
-
448: (<span class="ruby-constant">Si3</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
565
|
-
449: (<span class="ruby-constant">Si2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
566
|
-
450: (<span class="ruby-constant">Si1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
567
|
-
451: (<span class="ruby-constant">Si0</span>[(<span class="ruby-identifier">t2</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">1</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
568
|
-
452: <span class="ruby-identifier">s2</span> =
|
569
|
-
453: (<span class="ruby-constant">Si3</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
570
|
-
454: (<span class="ruby-constant">Si2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
571
|
-
455: (<span class="ruby-constant">Si1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
572
|
-
456: (<span class="ruby-constant">Si0</span>[(<span class="ruby-identifier">t3</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">2</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
573
|
-
457: <span class="ruby-identifier">s3</span> =
|
574
|
-
458: (<span class="ruby-constant">Si3</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
575
|
-
459: (<span class="ruby-constant">Si2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
576
|
-
460: (<span class="ruby-constant">Si1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
577
|
-
461: (<span class="ruby-constant">Si0</span>[(<span class="ruby-identifier">t0</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@dk</span>[<span class="ruby-value">3</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
578
|
-
462: [(<span class="ruby-value str">"%08x%08x%08x%08x"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">s0</span>, <span class="ruby-identifier">s1</span>, <span class="ruby-identifier">s2</span>, <span class="ruby-identifier">s3</span>])].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">"H*"</span>)
|
579
|
-
463: <span class="ruby-keyword kw">end</span>
|
580
|
-
</pre>
|
581
|
-
</div>
|
582
|
-
</div>
|
583
|
-
</div>
|
584
|
-
|
585
|
-
<div id="method-M000003" class="method-detail">
|
586
|
-
<a name="M000003"></a>
|
587
|
-
|
588
|
-
<div class="method-heading">
|
589
|
-
<a href="#M000003" class="method-signature">
|
590
|
-
<span class="method-name">_encrypt_block</span><span class="method-args">(pt)</span>
|
591
|
-
</a>
|
592
|
-
</div>
|
593
|
-
|
594
|
-
<div class="method-description">
|
595
|
-
<p><a class="source-toggle" href="#"
|
596
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
597
|
-
<div class="method-source-code" id="M000003-source">
|
598
|
-
<pre>
|
599
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 152</span>
|
600
|
-
152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_encrypt_block</span>(<span class="ruby-identifier">pt</span>)
|
601
|
-
153: <span class="ruby-comment cmt">#</span>
|
602
|
-
154: <span class="ruby-comment cmt"># map byte array block to cipher state and add initial round key:</span>
|
603
|
-
155: <span class="ruby-comment cmt">#</span>
|
604
|
-
156: <span class="ruby-identifier">s0</span> = (<span class="ruby-identifier">pt</span>[ <span class="ruby-value">0</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[ <span class="ruby-value">1</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[ <span class="ruby-value">2</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[ <span class="ruby-value">3</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">0</span>]
|
605
|
-
157: <span class="ruby-identifier">s1</span> = (<span class="ruby-identifier">pt</span>[ <span class="ruby-value">4</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[ <span class="ruby-value">5</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[ <span class="ruby-value">6</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[ <span class="ruby-value">7</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">1</span>]
|
606
|
-
158: <span class="ruby-identifier">s2</span> = (<span class="ruby-identifier">pt</span>[ <span class="ruby-value">8</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[ <span class="ruby-value">9</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[<span class="ruby-value">10</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[<span class="ruby-value">11</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">2</span>]
|
607
|
-
159: <span class="ruby-identifier">s3</span> = (<span class="ruby-identifier">pt</span>[<span class="ruby-value">12</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[<span class="ruby-value">13</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[<span class="ruby-value">14</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">pt</span>[<span class="ruby-value">15</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">3</span>]
|
608
|
-
160: <span class="ruby-comment cmt"># round 1:</span>
|
609
|
-
161: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
610
|
-
162: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">4</span>]
|
611
|
-
163: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
612
|
-
164: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">5</span>]
|
613
|
-
165: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
614
|
-
166: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">6</span>]
|
615
|
-
167: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
616
|
-
168: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">7</span>]
|
617
|
-
169: <span class="ruby-comment cmt"># round 2:</span>
|
618
|
-
170: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
619
|
-
171: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">8</span>]
|
620
|
-
172: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
621
|
-
173: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">9</span>]
|
622
|
-
174: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
623
|
-
175: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">10</span>]
|
624
|
-
176: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
625
|
-
177: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">11</span>]
|
626
|
-
178: <span class="ruby-comment cmt"># round 3:</span>
|
627
|
-
179: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
628
|
-
180: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">12</span>]
|
629
|
-
181: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
630
|
-
182: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">13</span>]
|
631
|
-
183: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
632
|
-
184: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">14</span>]
|
633
|
-
185: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
634
|
-
186: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">15</span>]
|
635
|
-
187: <span class="ruby-comment cmt"># round 4:</span>
|
636
|
-
188: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
637
|
-
189: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">16</span>]
|
638
|
-
190: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
639
|
-
191: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">17</span>]
|
640
|
-
192: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
641
|
-
193: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">18</span>]
|
642
|
-
194: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
643
|
-
195: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">19</span>]
|
644
|
-
196: <span class="ruby-comment cmt"># round 5:</span>
|
645
|
-
197: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
646
|
-
198: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">20</span>]
|
647
|
-
199: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
648
|
-
200: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">21</span>]
|
649
|
-
201: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
650
|
-
202: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">22</span>]
|
651
|
-
203: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
652
|
-
204: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">23</span>]
|
653
|
-
205: <span class="ruby-comment cmt"># round 6:</span>
|
654
|
-
206: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
655
|
-
207: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">24</span>]
|
656
|
-
208: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
657
|
-
209: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">25</span>]
|
658
|
-
210: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
659
|
-
211: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">26</span>]
|
660
|
-
212: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
661
|
-
213: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">27</span>]
|
662
|
-
214: <span class="ruby-comment cmt"># round 7:</span>
|
663
|
-
215: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
664
|
-
216: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">28</span>]
|
665
|
-
217: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
666
|
-
218: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">29</span>]
|
667
|
-
219: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
668
|
-
220: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">30</span>]
|
669
|
-
221: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
670
|
-
222: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">31</span>]
|
671
|
-
223: <span class="ruby-comment cmt"># round 8:</span>
|
672
|
-
224: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
673
|
-
225: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">32</span>]
|
674
|
-
226: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
675
|
-
227: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">33</span>]
|
676
|
-
228: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
677
|
-
229: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">34</span>]
|
678
|
-
230: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
679
|
-
231: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">35</span>]
|
680
|
-
232: <span class="ruby-comment cmt"># round 9:</span>
|
681
|
-
233: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
682
|
-
234: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">36</span>]
|
683
|
-
235: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
684
|
-
236: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">37</span>]
|
685
|
-
237: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
686
|
-
238: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">38</span>]
|
687
|
-
239: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
688
|
-
240: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">39</span>]
|
689
|
-
241: <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@nr</span> <span class="ruby-operator">></span> <span class="ruby-value">10</span>)
|
690
|
-
242: <span class="ruby-comment cmt"># round 10:</span>
|
691
|
-
243: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
692
|
-
244: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">40</span>]
|
693
|
-
245: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
694
|
-
246: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">41</span>]
|
695
|
-
247: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
696
|
-
248: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">42</span>]
|
697
|
-
249: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
698
|
-
250: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">43</span>]
|
699
|
-
251: <span class="ruby-comment cmt"># round 11:</span>
|
700
|
-
252: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
701
|
-
253: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">44</span>]
|
702
|
-
254: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
703
|
-
255: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">45</span>]
|
704
|
-
256: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
705
|
-
257: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">46</span>]
|
706
|
-
258: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
707
|
-
259: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">47</span>]
|
708
|
-
260: <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@nr</span> <span class="ruby-operator">></span> <span class="ruby-value">12</span>)
|
709
|
-
261: <span class="ruby-comment cmt"># round 12:</span>
|
710
|
-
262: <span class="ruby-identifier">s0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
711
|
-
263: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">48</span>]
|
712
|
-
264: <span class="ruby-identifier">s1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
713
|
-
265: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">49</span>]
|
714
|
-
266: <span class="ruby-identifier">s2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
715
|
-
267: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">50</span>]
|
716
|
-
268: <span class="ruby-identifier">s3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
717
|
-
269: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">t2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">51</span>]
|
718
|
-
270: <span class="ruby-comment cmt"># round 13:</span>
|
719
|
-
271: <span class="ruby-identifier">t0</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
720
|
-
272: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">52</span>]
|
721
|
-
273: <span class="ruby-identifier">t1</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
722
|
-
274: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s0</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">53</span>]
|
723
|
-
275: <span class="ruby-identifier">t2</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
724
|
-
276: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s1</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">54</span>]
|
725
|
-
277: <span class="ruby-identifier">t3</span> = <span class="ruby-constant">Te0</span>[<span class="ruby-identifier">s3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te1</span>[(<span class="ruby-identifier">s0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span>
|
726
|
-
278: <span class="ruby-constant">Te2</span>[(<span class="ruby-identifier">s1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-constant">Te3</span>[<span class="ruby-identifier">s2</span> <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">55</span>]
|
727
|
-
279: <span class="ruby-keyword kw">end</span>
|
728
|
-
280: <span class="ruby-keyword kw">end</span>
|
729
|
-
281: <span class="ruby-identifier">j</span> = <span class="ruby-ivar">@nr</span> <span class="ruby-operator"><<</span> <span class="ruby-value">2</span>
|
730
|
-
282: <span class="ruby-comment cmt">#</span>
|
731
|
-
283: <span class="ruby-comment cmt"># apply last round and map cipher state to byte array block:</span>
|
732
|
-
284: <span class="ruby-comment cmt">#</span>
|
733
|
-
285: <span class="ruby-identifier">s0</span> =
|
734
|
-
286: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
735
|
-
287: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
736
|
-
288: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
737
|
-
289: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">t3</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">0</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
738
|
-
290: <span class="ruby-identifier">s1</span> =
|
739
|
-
291: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
740
|
-
292: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
741
|
-
293: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
742
|
-
294: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">t0</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">1</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
743
|
-
295: <span class="ruby-identifier">s2</span> =
|
744
|
-
296: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">t2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
745
|
-
297: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
746
|
-
298: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
747
|
-
299: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">t1</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">2</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
748
|
-
300: <span class="ruby-identifier">s3</span> =
|
749
|
-
301: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">t3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
750
|
-
302: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">t0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
751
|
-
303: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">t1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
752
|
-
304: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">t2</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">3</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
753
|
-
305: [(<span class="ruby-value str">"%08x%08x%08x%08x"</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">s0</span>, <span class="ruby-identifier">s1</span>, <span class="ruby-identifier">s2</span>, <span class="ruby-identifier">s3</span>])].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">"H*"</span>)
|
754
|
-
306: <span class="ruby-keyword kw">end</span>
|
755
|
-
</pre>
|
756
|
-
</div>
|
757
|
-
</div>
|
758
|
-
</div>
|
759
|
-
|
760
|
-
<div id="method-M000002" class="method-detail">
|
761
|
-
<a name="M000002"></a>
|
762
|
-
|
763
|
-
<div class="method-heading">
|
764
|
-
<a href="#M000002" class="method-signature">
|
765
|
-
<span class="method-name">decryption_key_schedule</span><span class="method-args">(key)</span>
|
766
|
-
</a>
|
767
|
-
</div>
|
768
|
-
|
769
|
-
<div class="method-description">
|
770
|
-
<p><a class="source-toggle" href="#"
|
771
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
772
|
-
<div class="method-source-code" id="M000002-source">
|
773
|
-
<pre>
|
774
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 95</span>
|
775
|
-
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decryption_key_schedule</span>(<span class="ruby-identifier">key</span>)
|
776
|
-
96: <span class="ruby-comment cmt"># expand the cipher key:</span>
|
777
|
-
97: <span class="ruby-identifier">encryption_key_schedule</span>(<span class="ruby-identifier">key</span>)
|
778
|
-
98: <span class="ruby-ivar">@dk</span> = <span class="ruby-ivar">@ek</span>.<span class="ruby-identifier">dup</span>
|
779
|
-
99: <span class="ruby-comment cmt"># invert the order of the round keys:</span>
|
780
|
-
100: <span class="ruby-identifier">j</span> = <span class="ruby-value">4</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@nr</span>
|
781
|
-
101: <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
782
|
-
102: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
783
|
-
103: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">j</span>
|
784
|
-
104: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span>]
|
785
|
-
105: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span>]
|
786
|
-
106: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span>] = <span class="ruby-identifier">temp</span>
|
787
|
-
107: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
|
788
|
-
108: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>] = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
|
789
|
-
109: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>] = <span class="ruby-identifier">temp</span>
|
790
|
-
110: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">2</span>]
|
791
|
-
111: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">2</span>] = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span> <span class="ruby-operator">+</span> <span class="ruby-value">2</span>]
|
792
|
-
112: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span> <span class="ruby-operator">+</span> <span class="ruby-value">2</span>] = <span class="ruby-identifier">temp</span>
|
793
|
-
113: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">3</span>]
|
794
|
-
114: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">+</span> <span class="ruby-value">3</span>] = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span> <span class="ruby-operator">+</span> <span class="ruby-value">3</span>]
|
795
|
-
115: <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span> <span class="ruby-operator">+</span> <span class="ruby-value">3</span>] = <span class="ruby-identifier">temp</span>
|
796
|
-
116: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">4</span>
|
797
|
-
117: <span class="ruby-identifier">j</span> <span class="ruby-operator">-=</span> <span class="ruby-value">4</span>
|
798
|
-
118: <span class="ruby-keyword kw">end</span>
|
799
|
-
119: <span class="ruby-comment cmt"># apply the inverse MixColumn transform</span>
|
800
|
-
120: <span class="ruby-comment cmt"># to all round keys but the first and the last:</span>
|
801
|
-
121: <span class="ruby-identifier">j</span> = <span class="ruby-value">0</span>
|
802
|
-
122: <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-ivar">@nr</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
803
|
-
123: <span class="ruby-identifier">j</span> <span class="ruby-operator">+=</span> <span class="ruby-value">4</span>
|
804
|
-
124: <span class="ruby-identifier">w0</span>= <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span>]
|
805
|
-
125: <span class="ruby-identifier">w1</span> = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>]
|
806
|
-
126: <span class="ruby-identifier">w2</span> = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span><span class="ruby-operator">+</span><span class="ruby-value">2</span>]
|
807
|
-
127: <span class="ruby-identifier">w3</span> = <span class="ruby-ivar">@dk</span>[<span class="ruby-identifier">j</span><span class="ruby-operator">+</span><span class="ruby-value">3</span>]
|
808
|
-
128: <span class="ruby-ivar">@dk</span>[<span class="ruby-value">0</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] =
|
809
|
-
129: <span class="ruby-constant">Td0</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w0</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)] ]<span class="ruby-operator">^</span>
|
810
|
-
130: <span class="ruby-constant">Td1</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w0</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
811
|
-
131: <span class="ruby-constant">Td2</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w0</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
812
|
-
132: <span class="ruby-constant">Td3</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w0</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ]
|
813
|
-
133: <span class="ruby-ivar">@dk</span>[<span class="ruby-value">1</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] =
|
814
|
-
134: <span class="ruby-constant">Td0</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w1</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)] ] <span class="ruby-operator">^</span>
|
815
|
-
135: <span class="ruby-constant">Td1</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w1</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
816
|
-
136: <span class="ruby-constant">Td2</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w1</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
817
|
-
137: <span class="ruby-constant">Td3</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w1</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ]
|
818
|
-
138: <span class="ruby-ivar">@dk</span>[<span class="ruby-value">2</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] =
|
819
|
-
139: <span class="ruby-constant">Td0</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w2</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)] ] <span class="ruby-operator">^</span>
|
820
|
-
140: <span class="ruby-constant">Td1</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w2</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
821
|
-
141: <span class="ruby-constant">Td2</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w2</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
822
|
-
142: <span class="ruby-constant">Td3</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w2</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ]
|
823
|
-
143: <span class="ruby-ivar">@dk</span>[<span class="ruby-value">3</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] =
|
824
|
-
144: <span class="ruby-constant">Td0</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w3</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)] ] <span class="ruby-operator">^</span>
|
825
|
-
145: <span class="ruby-constant">Td1</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w3</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
826
|
-
146: <span class="ruby-constant">Td2</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w3</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ] <span class="ruby-operator">^</span>
|
827
|
-
147: <span class="ruby-constant">Td3</span>[<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">w3</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>] ]
|
828
|
-
148: <span class="ruby-keyword kw">end</span>
|
829
|
-
149: <span class="ruby-keyword kw">end</span>
|
830
|
-
</pre>
|
831
|
-
</div>
|
832
|
-
</div>
|
833
|
-
</div>
|
834
|
-
|
835
|
-
<div id="method-M000001" class="method-detail">
|
836
|
-
<a name="M000001"></a>
|
837
|
-
|
838
|
-
<div class="method-heading">
|
839
|
-
<a href="#M000001" class="method-signature">
|
840
|
-
<span class="method-name">encryption_key_schedule</span><span class="method-args">(key)</span>
|
841
|
-
</a>
|
842
|
-
</div>
|
843
|
-
|
844
|
-
<div class="method-description">
|
845
|
-
<p><a class="source-toggle" href="#"
|
846
|
-
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
847
|
-
<div class="method-source-code" id="M000001-source">
|
848
|
-
<pre>
|
849
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 19</span>
|
850
|
-
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encryption_key_schedule</span>(<span class="ruby-identifier">key</span>)
|
851
|
-
20: <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
852
|
-
21: <span class="ruby-ivar">@ek</span> = []
|
853
|
-
22: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">0</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">0</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">1</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">2</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">3</span>]
|
854
|
-
23: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">1</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">4</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">5</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">6</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">7</span>]
|
855
|
-
24: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">2</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">8</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">9</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">10</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">11</span>]
|
856
|
-
25: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">3</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">12</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">13</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">14</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">15</span>]
|
857
|
-
26: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@kl</span> <span class="ruby-operator">==</span> <span class="ruby-value">128</span>
|
858
|
-
27: <span class="ruby-identifier">j</span> = <span class="ruby-value">0</span>
|
859
|
-
28: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
860
|
-
29: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@ek</span>[<span class="ruby-value">3</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
861
|
-
30: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">4</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[<span class="ruby-value">0</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span>
|
862
|
-
31: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
863
|
-
32: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
864
|
-
33: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">temp</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
865
|
-
34: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span> <span class="ruby-constant">RCON</span>[<span class="ruby-identifier">i</span>]
|
866
|
-
35: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">5</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[<span class="ruby-value">1</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">4</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
867
|
-
36: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">6</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[<span class="ruby-value">2</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">5</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
868
|
-
37: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">7</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[<span class="ruby-value">3</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">6</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
869
|
-
38: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
870
|
-
39: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">10</span>)
|
871
|
-
40: <span class="ruby-identifier">j</span> <span class="ruby-operator">+=</span> <span class="ruby-value">4</span>
|
872
|
-
41: <span class="ruby-keyword kw">end</span>
|
873
|
-
42: <span class="ruby-keyword kw">end</span>
|
874
|
-
43: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">4</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">16</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">17</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">18</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">19</span>]
|
875
|
-
44: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">5</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">20</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">21</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">22</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">23</span>]
|
876
|
-
45: <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@kl</span> <span class="ruby-operator">==</span> <span class="ruby-value">192</span>)
|
877
|
-
46: <span class="ruby-identifier">j</span> = <span class="ruby-value">0</span>
|
878
|
-
47: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
879
|
-
48: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">5</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
880
|
-
49: <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">6</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">0</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span>
|
881
|
-
50: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
882
|
-
51: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
883
|
-
52: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">temp</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
884
|
-
53: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span> <span class="ruby-constant">RCON</span>[<span class="ruby-identifier">i</span>]
|
885
|
-
54: <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">7</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">1</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">6</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
886
|
-
55: <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">8</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">2</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">7</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
887
|
-
56: <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">9</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">3</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">8</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
888
|
-
57: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
889
|
-
58: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">8</span>)
|
890
|
-
59: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">10</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">4</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">9</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
891
|
-
60: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">11</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">5</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">10</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
892
|
-
61: <span class="ruby-identifier">j</span> <span class="ruby-operator">+=</span> <span class="ruby-value">6</span>
|
893
|
-
62: <span class="ruby-keyword kw">end</span>
|
894
|
-
63: <span class="ruby-keyword kw">end</span>
|
895
|
-
64: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">6</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">24</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">25</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">26</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">27</span>]
|
896
|
-
65: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">7</span>] = <span class="ruby-identifier">key</span>[<span class="ruby-value">28</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">24</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">29</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">16</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">30</span>] <span class="ruby-operator"><<</span> <span class="ruby-value">8</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>[<span class="ruby-value">31</span>]
|
897
|
-
66: <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@kl</span> <span class="ruby-operator">==</span> <span class="ruby-value">256</span>)
|
898
|
-
67: <span class="ruby-identifier">j</span> = <span class="ruby-value">0</span>
|
899
|
-
68: <span class="ruby-identifier">loop</span> <span class="ruby-keyword kw">do</span>
|
900
|
-
69: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">7</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
901
|
-
70: <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">8</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">0</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span>
|
902
|
-
71: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
903
|
-
72: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
904
|
-
73: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">temp</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
905
|
-
74: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span> <span class="ruby-constant">RCON</span>[<span class="ruby-identifier">i</span>]
|
906
|
-
75: <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">9</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">1</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">8</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
907
|
-
76: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">10</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">2</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">9</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
908
|
-
77: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">11</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">3</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">10</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
909
|
-
78: <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
910
|
-
79: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-value">7</span>)
|
911
|
-
80: <span class="ruby-identifier">temp</span> = <span class="ruby-ivar">@ek</span>[<span class="ruby-value">11</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
912
|
-
81: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">12</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">4</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span>
|
913
|
-
82: (<span class="ruby-constant">S3</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">24</span>)]) <span class="ruby-operator">^</span>
|
914
|
-
83: (<span class="ruby-constant">S2</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">16</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
915
|
-
84: (<span class="ruby-constant">S1</span>[(<span class="ruby-identifier">temp</span> <span class="ruby-operator">>></span> <span class="ruby-value">8</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>]) <span class="ruby-operator">^</span>
|
916
|
-
85: (<span class="ruby-constant">S0</span>[(<span class="ruby-identifier">temp</span>) <span class="ruby-operator">&</span> <span class="ruby-value">0xff</span>])
|
917
|
-
86: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">13</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">5</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">12</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
918
|
-
87: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">14</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">6</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">13</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
919
|
-
88: <span class="ruby-ivar">@ek</span>[<span class="ruby-value">15</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] = <span class="ruby-ivar">@ek</span>[ <span class="ruby-value">7</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>] <span class="ruby-operator">^</span> <span class="ruby-ivar">@ek</span>[<span class="ruby-value">14</span><span class="ruby-operator">+</span><span class="ruby-identifier">j</span>]
|
920
|
-
89: <span class="ruby-identifier">j</span> <span class="ruby-operator">+=</span> <span class="ruby-value">8</span>
|
921
|
-
90: <span class="ruby-keyword kw">end</span>
|
922
|
-
91: <span class="ruby-keyword kw">end</span>
|
923
|
-
92: <span class="ruby-keyword kw">end</span>
|
924
|
-
</pre>
|
925
|
-
</div>
|
926
|
-
</div>
|
927
|
-
</div>
|
928
|
-
|
929
|
-
<div id="method-M000005" class="method-detail">
|
930
|
-
<a name="M000005"></a>
|
931
|
-
|
932
|
-
<div class="method-heading">
|
933
|
-
<a href="#M000005" class="method-signature">
|
934
|
-
<span class="method-name">xor</span><span class="method-args">(a,b)</span>
|
935
|
-
</a>
|
936
|
-
</div>
|
937
|
-
|
938
|
-
<div class="method-description">
|
939
|
-
<p><a class="source-toggle" href="#"
|
940
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
941
|
-
<div class="method-source-code" id="M000005-source">
|
942
|
-
<pre>
|
943
|
-
<span class="ruby-comment cmt"># File lib/ruby-aes/aes_alg.rb, line 466</span>
|
944
|
-
466: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">xor</span>(<span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span>)
|
945
|
-
467: <span class="ruby-identifier">c</span> = <span class="ruby-value str">""</span>
|
946
|
-
468: <span class="ruby-value">16</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
947
|
-
469: <span class="ruby-identifier">c</span> <span class="ruby-operator"><<</span> (<span class="ruby-identifier">a</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">^</span> <span class="ruby-identifier">b</span>[<span class="ruby-identifier">i</span>]).<span class="ruby-identifier">chr</span>
|
948
|
-
470: <span class="ruby-keyword kw">end</span>
|
949
|
-
471: <span class="ruby-identifier">c</span>
|
950
|
-
472: <span class="ruby-keyword kw">end</span>
|
951
|
-
</pre>
|
952
|
-
</div>
|
953
|
-
</div>
|
954
|
-
</div>
|
955
|
-
|
956
|
-
|
957
|
-
</div>
|
958
|
-
|
959
|
-
|
960
|
-
</div>
|
961
|
-
|
962
|
-
|
963
|
-
<div id="validator-badges">
|
964
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
965
|
-
</div>
|
966
|
-
|
967
|
-
</body>
|
968
|
-
</html>
|