6 0 379 KB
Sample enkripsi dengan algoritma AES. Plaintext Kunci
32 88 31 e0 43 5a 31 37 f6 30 98 7 a8 8d a2 34 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
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
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
32 88 31 e0 43 5a 31 37 f6 30 98
⊕ 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
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
f7
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
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
8
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
ae
8
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 [1 1 3
3 2 1 1
1 𝑑4 1] [𝑏𝑓 3 5𝑑 2 30
1 3 2 1
𝑒0 𝑏4 52 𝑎𝑒
𝑏8 41 11 𝑓1
1𝑒 04 27 ] = [66 98 81 𝑒5 𝑒5
𝑒0 𝑐𝑏 19 9𝑎
48 𝑓8 𝑑3 7𝑎
28 06] 26 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 3 2 1
0 0 0 0
0 0 0 0
1 0 0 0
1 0 0 0
0 0 0 0
0 0 0 0
0 1 1 0
0 1 0 1
x5+x4 x+1 x 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 [66 81 𝑒5
𝑒0 𝑐𝑏 19 9𝑎
48 𝑓8 𝑑3 7𝑎
𝑎0 28 06] ⊕ [𝑓𝑎 𝑓𝑒 26 4𝑐 17
88 54 2𝑐 𝑏1
𝑎4 23 2𝑎 𝑎3 6𝑐 ] = [ 9𝑐 7𝑓 39 76 39 05 𝑓2
68 9𝑓 35 2𝑏
6𝑏 5𝑏 𝑒𝑎 43
02 6𝑎 ] 50 49
RoundKeys, cipherkey 2b 28 ab 09
09
cf
8a
7e ae f7
cf
cf
4f
84
15 d2 15 4f
4f
3c
eb
3c 09 Rotword
01
16 a6 88 3c
2b ⊕ 8a ⊕
01
a0
7e
84
00
fa
15
eb
00
16
01
00 01 00 00 00
=
⊕ 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
a0
1
0
1
0
0
0
0
0 (Baris 1)
Dengan cara yang sama, diperoleh fa, fe, 17 untuk baris 2,3 dan 4
fe 17
02 00 00 00
04 00 00 00
08 00 00 00
10 00 00 00
20 00 00 00
40 00 00 00
80 00 00 00
1b 00 00 00
28 ⊕ a0 ae fa d2 fe a6 17
36 00 00 00
88 54 2c b1
ab ⊕ 88 88 f7 54 54 15 2c 2c 88 b1 b1
09 ⊕ 23 88 cf a3 54 4f 39 2c 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
fa
54 54 54
fe
2c 2c 2c
f7
cf
15 d2 15 4f 16 a6 88 3c Cipherkey
17 b1 b1 b1 RoundKey 1
Resume hasil putaran 1 After SubBytes
After ShiftRows
d4 e0 b8 1e
d4 e0 b8 1e
27
bf b4 41
bf b4 41
11 98 5d 52 ae
f1
e5 30
27
5d 52 11 98 30 ae
f1
e5
After MixColumns 04 e0 48 28 66 cb
f8
RoundKeys a0 88 88 88
After AddRoundKeys a4 68 6b 2
6
fa
54 54 54
9c
81 19 d3 26
fe
2c 2c 2c
7f 35 ea 50
e5 9a 7a 4c
17 b1 b1 b1
f2
9f 5b 6a 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 Kunci Ciphertext
a3 c5 08 08 43 51 31 37 f6 30 98 07 a8 8d a2 34 2b 28 ab 9 7e ae f7 cf 15 d2 15 4f 16 a6 88 3c 39 02 dc 19 25 dc 11 6a 84 9 85 0b 1d fb 97 32