Anda di halaman 1dari 8

Sample enkripsi dengan algoritma AES.

Plaintext
32 88 31 e0 43 5a 31 37 f6 30 98 7 a8 8d a2 34
Kunci
2b 28 ab 9 7e ae f7 cf 15 d2 15 4f 16 a6 88 3c

Jawab :

Langkah 0 Plaintext ⊕ Kunci


0 0 1 1 0 0 1 0 1 0 0 0 1 0 00 0 0 1 1 0 0 0 1 1 1 1 0 0 0 00
32 88 31 e0
0 1 0 0 0 0 1 1 0 1 0 1 1 0 10 0 0 1 1 0 0 0 1 0 0 1 1 0 1 11
43 5a 31 37
f6 30 98 7 1 1 1 1 0 1 1 0 0 0 1 1 0 0 00 1 0 0 1 1 0 0 0 0 0 0 0 0 1 11

a8 8d a2 34 1 0 1 0 1 0 0 0 1 0 0 0 1 1 01 1 0 1 0 0 0 1 0 0 0 1 1 0 1 00

2b 28 ab 09 0 0 1 0 1 0 1 1 0 0 1 0 1 0 00 1 0 1 0 1 0 1 1 0 0 0 0 1 0 01
7e ae f7 cf 0 1 1 1 1 1 1 0 1 0 1 0 1 1 10 1 1 1 1 0 1 1 1 1 1 0 0 1 1 11
15 d2 15 4f 0 0 0 1 0 1 0 1 1 1 0 1 0 0 10 0 0 0 1 0 1 0 1 0 1 0 0 1 1 11
16 a6 88 3c 0 0 0 1 0 1 1 0 1 0 1 0 0 1 10 1 0 0 0 1 0 0 0 0 0 1 1 1 1 00
19 a0 9a e9 0 0 0 1 1 0 0 1 1 0 1 0 0 0 00 1 0 0 1 1 0 1 0 1 1 1 0 1 0 01

3d f4 c6 f8 0 0 1 1 1 1 0 1 1 1 1 1 0 1 00 1 1 0 0 0 1 1 0 1 1 1 1 1 0 00
e3 e2 8e 48 1 1 1 0 0 0 1 1 1 1 1 0 0 0 10 1 0 0 0 1 1 0 1 0 1 0 0 1 0 00
be 2b 2a 8 1 0 1 1 1 1 1 0 0 0 1 0 1 0 11 0 0 1 0 1 0 1 0 0 0 0 0 1 0 00
Putaran 1
Langkah satu, Transformasi Sub-Bytes menggunakan S-Box

19 a0 9a e9 d4 e0 b8 1e
3d f4 c6 f8 27 bf b4 41
e3 e2 8e 48 11 98 5d 52
be 2b 2a 8 ae f1 e5 30
Langkah dua, Transformasi ShifRows

d4 e0 b8 1e 0 d4 e0 b8 1e
27 bf b4 41 1 bf b4 41 27
11 98 5d 52 2 5d 52 11 98
ae f1 e5 30 3 30 ae f1 e5

Langkah tiga, Transformasi MixColumns

2 3 1 1 𝑑4 𝑒0 𝑏8 1𝑒 04 𝑒0 48 28
1] [𝑏𝑓 41 27 𝑓8
[1 2 3 𝑏4 ] = [66 𝑐𝑏 06]
1 1 2 3 5𝑑 52 11 98 81 19 𝑑3 26
3 1 1 2 30 𝑎𝑒 𝑓1 𝑒5 𝑒5 9𝑎 7𝑎 4𝑐

04 diperoleh dari perkalian elemen-elemen didalam matrik : = 2*d4+3*bf+1*5d+1*30...dst

x7 x6 x5 x4 x3 x2 x1 x0 Polinom pada GF(2n)


d4 1 1 0 1 0 1 0 0 x7+x6+x4+x2
bf 1 0 1 1 1 1 1 1 x7+x5+x4+x3+x2+x+1
5d 0 1 0 1 1 1 0 1 x6+x4+x3+x2+1
30 0 0 1 1 0 0 0 0 x5+x4
3 0 0 0 0 0 0 1 1 x+1
2 0 0 0 0 0 0 1 0 x
1 0 0 0 0 0 0 0 1 1
= x*(x7+x6+x4+x2) + (x+1) * (x7+x5+x4+x3+x2+x+1) + 1*(x6+x4+x3+x2+1) + 1*(x5+x4)
= x8+x7+x5+x3 + x8+x6+x5+x4+x3+x2+x+x7+x5+x4+x3+x2+x+1 + x6+x4+x3+x2+1 + x5+x4
= x2 = 00000100 = 04 (Hexa)
Jika diperoleh Polinom dengan pangkat lebih dari 7, disederhanakan dengan modulo x8+x4+x3+x+1.
Langkah empat, Transformasi AddRoundKeys

04 𝑒0 48 28 𝑎0 88 23 2𝑎 𝑎4 68 6𝑏 02
[66 𝑐𝑏 𝑓8 06] ⊕ [𝑓𝑎 54 𝑎3 6𝑐 ] = [ 9𝑐 9𝑓 5𝑏 6𝑎 ]
81 19 𝑑3 26 𝑓𝑒 2𝑐 39 76 7𝑓 35 𝑒𝑎 50
𝑒5 9𝑎 7𝑎 4𝑐 17 𝑏1 39 05 𝑓2 2𝑏 43 49

RoundKeys, cipherkey

2b 28 ab 09 09 cf 8a
7e ae f7 cf cf 4f 84
15 d2 15 4f 4f 3c eb
16 a6 88 3c 3c 09 01
Rotword
⊕ 2b 0 0 1 0 1 0 1 1
8a 1 0 0 0 1 0 1 0
01 0 0 0 0 0 0 0 1
2b ⊕ 8a ⊕ 01 a0 a0 1 0 1 0 0 0 0 0 (Baris 1)
7e 84 00 fa Dengan cara yang sama, diperoleh fa, fe, 17 untuk baris 2,3 dan 4
=
15 eb 00 fe
16 01 00 17

01 02 04 08 10 20 40 80 1b 36 28 ⊕ a0 88 ab ⊕ 88 88 09 ⊕ 23 88
00 00 00 00 00 00 00 00 00 00 ae fa 54 f7 54 54 cf a3 54
00 00 00 00 00 00 00 00 00 00 d2 fe 2c 15 2c 2c 4f 39 2c
00 00 00 00 00 00 00 00 00 00 a6 17 b1 88 b1 b1 3c 39 b1

RoundKey 1 untuk kolom 2,3 dan 4 dilakukan secara berantai melalui XOR antara kolom cipherkey dengan hasil roundkey kolom sebelumnya
key awal

2b 28 ab 09 a0 88 88 88
7e ae f7 cf fa 54 54 54
15 d2 15 4f fe 2c 2c 2c
16 a6 88 3c 17 b1 b1 b1
Cipherkey RoundKey 1

Resume hasil putaran 1


After SubBytes After ShiftRows After MixColumns RoundKeys After AddRoundKeys
d4 e0 b8 1e d4 e0 b8 1e 04 e0 48 28 a0 88 88 88 a4 68 6b 2
27 bf b4 41 bf b4 41 27 66 cb f8 6 fa 54 54 54 9c 9f 5b 6a
11 98 5d 52 5d 52 11 98 81 19 d3 26 fe 2c 2c 2c 7f 35 ea 50
ae f1 e5 30 30 ae f1 e5 e5 9a 7a 4c 17 b1 b1 b1 f2 2b 43 49
Putaran dua sampai dengan putaran 10
Mengulangi langkah dua sampai langkah empat seperti pada putaran satu.
Masukan awal untuk putaran dua diambil dari hasil After RoundKeys putaran pertama.
Masukan awal untuk putaran tiga diambil dari hasil After RoundKeys putaran kedua, dan seterusnya sehingga diperoleh hasil sebagai
berikut :
Jadi diperoleh :
Plaintext a3 c5 08 08 43 51 31 37 f6 30 98 07 a8 8d a2 34
Kunci 2b 28 ab 9 7e ae f7 cf 15 d2 15 4f 16 a6 88 3c
Ciphertext 39 02 dc 19 25 dc 11 6a 84 9 85 0b 1d fb 97 32

Anda mungkin juga menyukai