Cryptography Reference
In-Depth Information
The block
s
is also called state and represented as a matrix of terms
s
i
,
j
for
i
,
j
∈
{
. Terms are bytes, i.e. elements of a set
Z
of cardinality 256. SubBytes is
defined as follows.
0
,
1
,
2
,
3
}
SubBytes
(
s
)
1:
for
i
=
0to3
do
2:
for
j
=
0to3
do
3:
s
i
,
j
←
S-box(
s
i
,
j
)
4:
end for
5:
end for
Here
S-box
is
the
substitution
table.
Mathematically,
it
is
a
permutation
of
{
0
,
1
,...,
255
}
. ShiftRows is defined as follows.
ShiftRows
(
s
)
1: replace [
s
1
,
0
,
s
1
,
1
,
s
1
,
2
,
s
1
,
3
]by[
s
1
,
1
,
s
1
,
2
,
s
1
,
3
,
s
1
,
0
]
{
rotate row 1 by one position to the left
}
2: replace [
s
2
,
0
,
s
2
,
1
,
s
2
,
2
,
s
2
,
3
]by[
s
2
,
2
,
s
2
,
3
,
s
2
,
0
,
s
2
,
1
]
{
rotate row 2 by two positions to the left
}
3: replace [
s
3
,
0
,
s
3
,
1
,
s
3
,
2
,
s
3
,
3
]by[
s
3
,
3
,
s
3
,
0
,
s
3
,
1
,
s
3
,
2
]
{
rotate row 3 by three positions to the left
}
We define the set
Z
as the set of all the 256 possible combinations
x
2
x
7
a
0
+
a
1
.
x
+
a
2
.
+···+
a
7
.
where
a
0
,
a
7
are either 0 or 1 and
x
is a formal term. Elements of
Z
are thus
defined as polynomials of degree at most 7. AddRoundKey is defined as follows.
a
1
,
a
2
,...,
AddRoundKey
(
s
,
k
)
1:
for
i
=
0to3
do
2:
for
j
=
0to3
do
3:
s
i
,
j
←
s
i
,
j
⊕
k
i
,
j
4:
end for
5:
end for
Here the
⊕
operation over
Z
is defined as an addition modulo 2, i.e.
7
x
i
7
x
i
7
x
i
a
i
.
⊕
b
i
.
=
(
a
i
+
b
i
mod 2)
.
.
i
=
0
i
=
0
i
=
0
A multiplication
×
in
Z
is further defined as follows.
Search WWH ::
Custom Search