created at 2021-03-10
AES
has symmetric key, symmetric block cypher
- Key generation
- Round
Key generation
if we want to HWANGBO!HWANGBO!ETASDFCAERAX
words into cipher text, first cut in 16 byte block.
HWANGBO!HWANGBO!
will be the first block and ETASDFCAERAX
will be the second block.
- Change words into hexadecimal
1st column | 2nd column | 3rd column | 4th column |
---|---|---|---|
48 (H) | 57 (W) | 41 (A) | 4E (N) |
47 (G) | 42 (B) | 4F (O) | 21 (!) |
48 (H) | 57 (W) | 41 (A) | 4E (N) |
47 (G) | 42 (B) | 4F (O) | 21 (!) |
- 1st column :
48 47 48 47
- 2nd column :
57 72 57 72
- 3rd column :
41 4f 41 4f
- 4th column :
4e 21 4e 21
- rotate last column and alter value with S-Box
S-Box is a substitution table that change numbers to non-linear.
47 -> a0
4f | => | 21 | => | fd |
21 | => | 47 | => | a0 |
Result
sub byte column
40 |
84 |
fd |
a0 |
- [1st column key state] XOR [last sub byte column] XOR [1st column RCON] = [1st column KEY]
RCON
48 | 40 | 01 |
| 57 | | 84 | | 00 | XOR XOR | 41 | | fd | | 00 |
4e | a0 | 00 |
Result
79 |
d3 |
bc |
ee |
- [1st column KEY] XOR [2nd column key state] = [2nd column KEY]
Thus, result 4 * 4 metrix => KEY 1
KEY 1->key state and loop back to 3 until 10 times
- FINALLY!
We now have CYPHER KEY 1~10
Rounds ***
- Initial Round
[Pain Text(128 bit)] XOR [CYPHER KEY 1] = initial STATE
- Main Round
8.1 initial STATE -> Sub-byte
8.2 Sub-byte -> Shift rows
8.3 Shift rows -> Mix column
8.4 Mix column -> XOR with CYPHER KEY 1
8.5 Loop to 8.1 until 10 times
- Last Round
After loop main round 10 times XOR caculation with CYPHER KEY, we now get CYPHER TEXT!!!
Overall procedure
Pain Text(128 bit) [ENCRYPTION] CYPHER KEY 1~10(128/192/256 bit) => Cypher Text(128 bit)