Chapter 3.1
Chapter 3.1
BURIE CAMPUS
DEPARTMENT OF COMPUTER SCIENCE
Computer Security
By:
Amare W.
1
2
Chapter 3: continued
It is extremely complex
4 01/27/2025
♥ AES encrypts and decrypts a data block size of 128 bits. Key
lengths can be 128 bits, 192 bits, or 256 bits;
♥ The algorithm is referred to as AES-128, AES-192, or AES-
256, depending on the key length.
♥ AES-128 uses 10 rounds, AES-192 uses 12 rounds, and AES-
256 uses 14 rounds.
♥ However, the round key, which are generated by the key
expansion algorithm are always 128 bits, the same size as
3/2/2018
E
n
F c
i r
g y
u p
r t
e i
o
n
P
r
o
c
3/2/2018
e
s
s
10 01/27/2025
3/2/2018
...a15. The bytes and the bit ordering within bytes are derived from the 128-bit input
sequence:
input0 input1 input2 … input126 input127
as follows: a0 = {input0, input1, …, input7};
a1 = {input8, input9, …, input15};
3/2/2018
…
a15 = {input120, input121, …, input127}.
15 01/27/2025
iii. Words:
♥ A word is a group of 32 bits that can be treated as a single entity, a row
matrix of 4 bytes, or a column matrix of 4 bytes.
iv. Blocks:
♥ AES encrypts and decrypts data blocks. A block in AES is a group of 128
bits. However, a block can be represented as a row matrix of 16 bytes.
v. States:
♥ AES uses the term data block at the beginning and end of the cipher; before
and after each stage, the data block is referred to as state.
♥ AES algorithm’s operations are performed on a two-dimensional array of
bytes called the State.
3/2/2018
♥ The State consists of four rows of bytes, each containing Nb bytes, where Nb
is the block length divided by 32.
16 01/27/2025
♥ In the State array denoted by the symbol s, each individual byte has two indices, with
its row number r in the range 0 ≤ r < 4 and its column number c in the range 0 ≤ c < Nb.
♥ This allows an individual byte of the State to be referred to as either sr,c or s[r,c]. For
♥ At the start of the Cipher and Inverse Cipher, the input, the array of bytes in0, in1, …
3/2/2018
17 01/27/2025
and at the end of the Cipher and Inverse Cipher, the State is copied
to the output array out as follows:
♥ The four bytes in each column of the State array form 32-bit
words, where the row number r provides an index for the four
bytes within each word.
♥ The state can hence be interpreted as a one-dimensional array of
32 bit words (columns), w0,...,w3, where the column number c
provides an index into this array.
♥ Hence, for the following example, the State can be considered as
an array of four words, as follows:
w0 = s0,0 s1,0 s2,0 s3,0 w2 = s0,2 s1,2 s2,2 s3,2 3/2/2018
….cont’d
Algorithm Specification
♥ For the AES algorithm, the length of the input block, the output
block and the State is 128 bits.
Key Length (Nk words) Block Size (Nb words) Number of Rounds (Nr)
AES-128 4 4 10 3/2/2018
AES-192 6 4 12
21 01/27/2025
3/2/2018
23 01/27/2025
A
A
E
E
S
S
E
D
N
E
C
C
R
R
Y
Y
P
P
T
T
I
I
O
O
N
N
3/2/2018
25 01/27/2025
5) Only the Add Round Key stage makes use of the key. For this
reason, the cipher begins and ends with an Add Round Key stage.
6) The Add Round Key stage by itself would not be formidable. The
other three stages together provide confusion, diffusion, and
nonlinearity, but by themselves would provide no security because
3/2/2018
For the Add Round Key stage, the inverse is achieved by XORing
the same round key to the block. 3/2/2018
27 01/27/2025
3/2/2018
3/2/2018
29 01/27/2025
♥ For both its Cipher and Inverse Cipher, the AES algorithm uses a
round function that is composed of four different byte-oriented
transformations:
1) byte substitution using a substitution table (S-box),
2) shifting rows of the State array by different offsets,
3) mixing the data within each column of the State array, and
4) adding a Round Key to the State.
♥ We now turn to a discussion of each of the four transformations
used in AES. For each stage, we describe the forward
(encryption) algorithm, and the inverse (decryption) algorithm
3/2/2018
♥ These row and column values serve as indexes into the S-box to select a
unique 8-bit output value. 3/2/2018
31 01/27/2025
♥ The following Figure illustrates the effect of the SubBytes()transformation on the State:
♥ In the SubBytes step, each byte in the state is replaced with its entry in a fixed 8-bit
lookup table, S; bij = S(aij) The S-box used in the SubBytes()transformation is presented
in hexadecimal form in the following table.
♥ For example, if a1,1 = {53}, then the substitution value would be determined by the
intersection of the row with index ‘5’ and the column with index ‘3’. This would result
in b11 having a value of {ED}.
3/2/2018
♥ The hexadecimal value {95} references row 9, column 5 of the S-box, which contains
the value. Accordingly, the value {95} is mapped into the value {2A}.
32 01/27/2025
T
a
b
l
e
:
A
E
S
S
-
B
o
x
Table: AES
Inverse S-Box
3/2/2018
34 01/27/2025
♥ For blocks of sizes 128 and 192 bits, the shifting pattern is the same. Row n is
shifted left circular by n-1 bytes.
♥ In this way, each column of the output state of the ShiftRows step is composed of
bytes from each column of the input state.
♥ The inverse shift row transformation, called InvShiftRows, performs the circular
shifts in the opposite direction for each of the last three rows.
First row is not affected
a 1-byte circular right shift for the second row,
3/2/2018
a 2-byte circular right shift for the third row and
a 3-byte circular right shift for the fourth row.
36 01/27/2025
3/2/2018
37 01/27/2025
3/2/2018
38
♥ Let us verify the first column of this example. In GF(28), addition is the bitwise
XOR operation and that multiplication can be performed according to the
previous rule. In particular, multiplication of a value by x (i.e., by {02}) can be
implemented as a 1-bit left shift followed by a conditional bitwise XOR with
(0001 1011) if the leftmost bit of the original value (prior to the shift) is 1.
♥ Thus, to verify the MixColumns transformation on the first column, we need to
show that
({02}.{87}) ⊕ ({03}.{6E}) ⊕ {46} ⊕ {A6} ={47}
{87} ⊕ ({02}.{6E}) ⊕ ({03}.{46}) ⊕ {A6} ={37}
3/2/2018
{87} ⊕ {6E} ⊕ ({02}.{46}) ⊕ ({03}.{A6}) ={94}
({03}.{87}) ⊕ {6E} ⊕ {46} ⊕ ({02}.{A6}) ={ED}
40 01/27/2025
verified.
41 01/27/2025
We need to show
3/2/2018
42 01/27/2025
♥ That is, the inverse transformation matrix times the forward transformation matrix
equals the identity matrix. To verify the first column of the above equation, we
need to show
({0E}.{02}) ⊕ {0B} ⊕ {0D} ⊕ ({09}.{03}) ={01}
({09}.{02}) ⊕ {0E} ⊕ {0B} ⊕ ({0D}.{03}) ={00}
({0D}.{02}) ⊕ {09} ⊕ {0E} ⊕ ({0B}.{03}) ={00}
({0B}.{02}) ⊕ {0D} ⊕ {09} ⊕ ({0E}.{03}) ={00}
For the first equation, we have
{0E}.{02} = 0001 1100
{09}.{03} = {09} ⊕ ({09}.{02}) =00001001 ⊕ 00010010 = 0001 1011
Then {0E}.{02} = 0001 1100
{0B} = 0000 1011
{0D} = 0000 1101
{09}.{03} = 0001 1011 3/2/2018
0000 0001
The other equations can be similarly verified.
43 01/27/2025
♥ The first matrix is State, and the second matrix is the round key.
♥ The inverse add round key transformation is identical to the
forward add round key transformation, because the XOR
3/2/2018
operation is its own inverse.
45
Thank you