0% found this document useful (0 votes)
253 views18 pages

AES Example PDF

The document provides an example of the AES encryption process using a 128-bit key and plaintext. It shows the key and plaintext values in hexadecimal, describes the generation of round keys through key scheduling, and demonstrates each step of the AES algorithm over multiple rounds including byte substitution, shifting rows, mixing columns, and adding the round key.

Uploaded by

abdul mouiz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
253 views18 pages

AES Example PDF

The document provides an example of the AES encryption process using a 128-bit key and plaintext. It shows the key and plaintext values in hexadecimal, describes the generation of round keys through key scheduling, and demonstrates each step of the AES algorithm over multiple rounds including byte substitution, shifting rows, mixing columns, and adding the round key.

Uploaded by

abdul mouiz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

AES Example - Input (128 bit key and message)

Key in English: Thats my Kung Fu (16 ASCII characters, 1 byte each)


Translation into Hex:

T h a t s m y K u n g F u
54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75

Key in Hex (128 bits): 54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75


Plaintext in English: Two One Nine Two (16 ASCII characters, 1 byte each)
Translation into Hex:

Tw o O n e N i n e Tw o
54 77 6F 20 4F 6E 65 20 4E 69 6E 65 20 54 77 6F

Plaintext in Hex (128 bits): 54 77 6F 20 4F 6E 65 20 4E 69 6E 65 20 54 77 6F

1
AES Example - The first Roundkey
• Key in Hex (128 bits): 54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75
• w[0] = (54, 68, 61, 74), w[1] = (73, 20, 6D, 79), w[2] = (20, 4B, 75, 6E), w[3] = (67, 20, 46, 75)
• g(w[3]):
• circular byte left shift of w[3]: (20, 46, 75, 67)
• Byte Substitution (S-Box): (B7, 5A, 9D, 85)
• Adding round constant (01, 00, 00, 00) gives: g(w[3]) = (B6, 5A, 9D, 85)

• w[4] = w[0] ⊕ g(w[3]) = (E2, 32, F C, F 1):


0101 0100 0110 1000 0110 0001 0111 0100
1011 0110 0101 1010 1001 1101 1000 0101
1110 0010 0011 0010 1111 1100 1111 0001
E2 32 FC F1
• w[5] = w[4] ⊕ w[1] = (91, 12, 91, 88), w[6] = w[5] ⊕ w[2] = (B1, 59, E4, E6),
w[7] = w[6] ⊕ w[3] = (D6, 79, A2, 93)
• first roundkey: E2 32 FC F1 91 12 91 88 B1 59 E4 E6 D6 79 A2 93

2
AES Example - All RoundKeys

• Round 0: 54 68 61 74 73 20 6D 79 20 4B 75 6E 67 20 46 75
• Round 1: E2 32 FC F1 91 12 91 88 B1 59 E4 E6 D6 79 A2 93
• Round 2: 56 08 20 07 C7 1A B1 8F 76 43 55 69 A0 3A F7 FA
• Round 3: D2 60 0D E7 15 7A BC 68 63 39 E9 01 C3 03 1E FB
• Round 4: A1 12 02 C9 B4 68 BE A1 D7 51 57 A0 14 52 49 5B
• Round 5: B1 29 3B 33 05 41 85 92 D2 10 D2 32 C6 42 9B 69
• Round 6: BD 3D C2 B7 B8 7C 47 15 6A 6C 95 27 AC 2E 0E 4E
• Round 7: CC 96 ED 16 74 EA AA 03 1E 86 3F 24 B2 A8 31 6A
• Round 8: 8E 51 EF 21 FA BB 45 22 E4 3D 7A 06 56 95 4B 6C
• Round 9: BF E2 BF 90 45 59 FA B2 A1 64 80 B4 F7 F1 CB D8
• Round 10: 28 FD DE F8 6D A4 24 4A CC C0 A4 FE 3B 31 6F 26

3
AES Example - Add Roundkey, Round 0
• State Matrix and Roundkey No.0 Matrix:
   
54 4F 4E 20 54 73 20 67
 77 6E 69 54  68 20 4B 20
   
6F 65 6E 77  61 6D 75 46
20 20 65 6F 74 79 6E 75
• XOR the corresponding entries, e.g., 69 ⊕ 4B = 22
0110 1001
0100 1011
0010 0010
• the new State Matrix is
 
00 3C 6E 47
1F 4E 22 74 
 
0E 08 1B 31 
54 59 0B 1A

4
AES Example - Round 1, Substitution Bytes
• current State Matrix is
 
00 3C 6E 47
1F 4E 22 74 
 
0E 08 1B 31 
54 59 0B 1A
• substitute each entry (byte) of current state matrix by corresponding entry in AES
S-Box
• for instance: byte 6E is substituted by entry of S-Box in row 6 and column E, i.e.,
by 9F
• this leads to new State Matrix
 
63 EB 9F A0
 C0 2F 93 92 
 
AB 30 AF C7
20 CB 2B A2
• this non-linear layer is for resistance to differential and linear cryptanalysis attacks
5
AES Example - Round 1, Shift Row

• the current State Matrix is


 
63 EB 9F A0
 C0 2F 93 92 
 
AB 30 AF C7
20 CB 2B A2
• four rows are shifted cyclically to the left by offsets of 0,1,2, and 3
• the new State Matrix is
 
63 EB 9F A0
 2F 93 92 C0
 
AF C7 AB 30 
A2 20 CB 2B
• this linear mixing step causes diffusion of the bits over multiple rounds

6
AES Example - Round 1, Mix Column

• Mix Column multiplies fixed matrix against current State Matrix:


    
02 03 01 01 63 EB 9F A0 BA 84 E8 1B
01 02 03 01  2F 93 92 C0  75 A4 8D 40 
01 01 02 03 AF C7 AB 30  =  F 4 8D 06 7D 
    

03 01 01 02 A2 20 CB 2B 7A 32 0E 5D
• entry BA is result of (02 • 63) ⊕ (03 • 2F ) ⊕ (01 • AF ) ⊕ (01 • A2):
• 02 • 63 = 00000010 • 01100011 = 11000110
• 03 • 2F = (02 • 2F ) ⊕ 2F = (00000010 • 00101111) ⊕ 00101111 = 01110001
• 01 • AF = AF = 10101111 and 01 • A2 = A2 = 10100010
• hence
11000110
01110001
10101111
10100010
10111010

7
AES Example - Add Roundkey, Round 1

• State Matrix and Roundkey No.1 Matrix:


   
BA 84 E8 1B E2 91 B1 D6
 75 A4 8D 40   32 12 59 79 
   
 F 4 8D 06 7D F C 91 E4 A2 
7A 32 0E 5D F 1 88 E6 93
• XOR yields new State Matrix
 
58 15 59 CD
 47 B6 D4 39 
 
 08 1C E2 DF 
8B BA E8 CE
• AES output after Round 1: 58 47 08 8B 15 B6 1C BA 59 D4 E2 E8 CD 39 DF CE

8
AES Example - Round 2

• after Substitute Byte and after Shift Rows:

   
6A 59 CB BD 6A 59 CB BD
 A0 4E 48 12  4E 48 12 A0 
   
 30 9C 98 9E   98 9E 30 9B 
3D F 4 9B 8B 8B 3D F 4 9B

• after Mixcolumns and after Roundkey:

   
15 C9 7F 9D 43 0E 09 3D
CE 4D 4B C2  C6 57 08 F 8 
   
 89 71 BE 88  A9 C0 EB 7F 
65 47 97 CD 62 C8 F E 37

9
AES Example - Round 3

• after Substitute Byte and after Shift Rows:

   
1A AB 01 27 1A AB 01 27
 B4 5B 30 41  5B 30 41 B4 
   
 D3 BA E9 D2 E9 D2 D3 BA 
AA E8 BB 9A A9 AA E8 BB

• after Mixcolumns and after Roundkey:

   
AA 65 F A 88 78 70 99 4B
 16 0C 05 3A 76 76 3C 39 
   
 3D C1 DE 2A 30 7D 37 34 
B3 4B 5A 0A 54 23 5B F 1

10
AES Example - Round 4

• after Substitute Byte and after Shift Rows:

   
BC 51 EE B3 BC 51 EE B3
 38 38 EB 12   38 EB 12 38 
   
 04 F F 9A 18   9A 18 04 F F 
20 26 39 A1 A1 20 26 39

• after Mixcolumns and after Roundkey:

   
10 BC D3 F 3 B1 08 04 E7
D8 94 E0 E0  CA F C B1 B2
   
 53 EA 9E 25   51 54 C9 6C 
24 40 73 7B ED E1 D3 20

11
AES Example - Round 5

• after Substitute Byte and after Shift Rows:

   
C8 30 F 2 94 C8 30 F 2 94
 74 B0 C8 37   B0 C8 37 74
   
D1 20 DD 50  DD 50 D1 20
55 F 8 66 B7 B7 55 F 8 66

• after Mixcolumns and after Roundkey:

   
2A 26 8F E9 9B 23 5D 2F
 78 1E 0C 7A  51 5F 1C 38 
   
1B A7 6F 0A  20 22 BD 91 
5B 62 00 3F 68 F 0 32 56

12
AES Example - Round 6

• after Substitute Byte and after Shift Rows:

   
14 26 4C 15 14 26 4C 15
D1 CF 9C 07  CF 9C 07 D1
   
B7 93 7A 81   7A 81 B7 93 
45 8C 23 B1 B1 45 8C 23

• after Mixcolumns and after Roundkey:

   
A9 37 AA F 2 14 8F C0 5E
AE D8 0C 21  93 A4 60 0F 
   
 E7 6C B1 9C  25 2B 24 92 
F 0 F D 67 3B 77 E8 40 75

13
AES Example - Round 7

• after Substitute Byte and after Shift Rows:

   
F A 73 BA 58 F A 73 BA 58
DC 49 D0 76   49 D0 76 DC 
   
 3F F 1 36 4F   36 4F 3F F 1 
F 5 9B 09 9D 9D F 5 9B 09

• after Mixcolumns and after Roundkey:

   
9F 37 51 37 53 43 4F 85
AF EC 8C F A  39 06 0A 52 
   
 63 39 04 66  8E 93 3B 57 
4B F B B1 D7 5D F 8 95 BD

14
AES Example - Round 8

• after Substitute Byte and after Shift Rows:

   
ED 1A 84 97 ED 1A 84 97
 12 6F 67 00   6F 67 00 12 
   
 19 DC E2 5B   E2 5B 19 DC 
4C 41 2A 7A 7A 4C 41 2A

• after Mixcolumns and after Roundkey:

   
E8 8A 4B F 5 66 70 AF A3
 74 75 EE E6  25 CE D3 73 
   
D3 1F 75 58  3C 5A 0F 13 
55 8A 0C 38 74 A8 0A 54

15
AES Example - Round 9

• after Substitute Byte and after Shift Rows:

   
33 51 79 0A 33 51 79 0A
 3F 8B 66 8F  8B 66 8F 3F 
   
EB BE 76 7D   76 7D EB BE 
92 C2 67 20 20 92 C2 67

• after Mixcolumns and after Roundkey:

   
B6 E7 51 8C 09 A2 F 0 7B
 84 88 98 CA   66 D1 F C 3B 
   
 34 60 66 F B  8B 9A E6 30 
E8 D7 70 51 78 65 C4 89

16
AES Example - Round 10

• after Substitute Byte and after Shift Rows:


   
01 3A 8C 21 01 3A 8C 21
 33 3E B0 E2 3E B0 E2 33 
   
 3D B8 8E 04  8E 04 3D B8
BC 4D 1C A7 A7 BC 4D 1C

• after Roundkey (Attention: no Mix columns in last round):


 
29 57 40 1A
C3 14 22 02 
 
 50 20 99 D7
5F F 6 B3 3A
• ciphertext: 29 C3 50 5F 57 14 20 F6 40 22 99 B3 1A 02 D7 3A

17

You might also like