●3 version
1. AES 128(10 round, cipher key:128 bit)
2. AES 192(12 round, cipher key:192 bit)
3. AES 256(14 round, cipher key:256 bit)
●steps
1. Pre-round
和key做XOR
和key做XOR
2. Subbyte(Substation)
3. Shiftrow(Permutation)
每個row做left shift
Row1: x
Row2: 1 byte
Row3: 2 byte
Row4: 3 byte
4. Mix column
每個column獨立做(column乘constant matrix)
最後一個column不做
5. Add round key
每個column獨立做, plaintext 和 roundkey 做 XOR
6. 2, 3, 4, 5為一個round 依照不同version 做不同round
AES每個round的流程圖
● key expansion
1. AES 128:每個round需要4個word(wi, wi+1, wi+2, wi+3)
(1). pre-round:w0, w1, w2, w3 為cipher key
(2). 當i mod 4 = 0:
wi = t + wi-4
t = Sub(Rot(wi-1)) + Rcon[i/4]
(3). 當i mod 4 ≠ 0:
wi = wi-1 + wi-4
AES key產生圖
2. AES 192:每次產生6個word(wi, wi+1, wi+2, wi+3, wi+4, wi+5)
和AES 128同,但4均改為6
(wi = t + wi-6)
( wi = wi-1 + wi-6)
3. AES 256:每次產生8個word(wi, wi+1, wi+2, wi+3, wi+4, wi+5, wi+6, wi+7)
(1). pre-round:w0, w1, w2, w3 為cipher key
(2). 當i mod 8 = 0:
wi = t + wi-8
t = Sub(Rot(wi-1)) + Rcon
(3). 當i mod 4 = 0, 且i mod 8 ≠ 0:
wi = SubWord(wi-1) + wi-8
(4). 當i mod 8 ≠ 0:
wi = wi-1 + wi-8
● key expansion
1. AES 128:每個round需要4個word(wi, wi+1, wi+2, wi+3)
(1). pre-round:w0, w1, w2, w3 為cipher key
(2). 當i mod 4 = 0:
wi = t + wi-4
t = Sub(Rot(wi-1)) + Rcon[i/4]
(3). 當i mod 4 ≠ 0:
wi = wi-1 + wi-4
AES key產生圖
2. AES 192:每次產生6個word(wi, wi+1, wi+2, wi+3, wi+4, wi+5)
和AES 128同,但4均改為6
(wi = t + wi-6)
( wi = wi-1 + wi-6)
3. AES 256:每次產生8個word(wi, wi+1, wi+2, wi+3, wi+4, wi+5, wi+6, wi+7)
(1). pre-round:w0, w1, w2, w3 為cipher key
(2). 當i mod 8 = 0:
wi = t + wi-8
t = Sub(Rot(wi-1)) + Rcon
(3). 當i mod 4 = 0, 且i mod 8 ≠ 0:
wi = SubWord(wi-1) + wi-8
(4). 當i mod 8 ≠ 0:
wi = wi-1 + wi-8