-
Notifications
You must be signed in to change notification settings - Fork 0
ghkdqhrbals:AES(Advanced Encryption Standard)
has symmetric key, symmetric block cypher
- Key generation
- Round
Key generation
if we want to 'HWANGBO!HWANGBO!' 16 words into cypher text
H -> 48(Hexadecimal) -> 8 bit
'HWANGBO!HWANGBO!' -> 8 bit * 16 = 128 bit
- Change words into hexadecimal
Result
| 48 | 57 | 41 | 4e | 47 | 42 | 4f | 21 | 48 | 57 | 41 | 4e | 47 | 42 | 4f | 21 |
1st column 2nd column 3rd column 4th column
- hexadecimal to key state
Key state
'HWAN' : 1st column of key state
'GBO!' : 2nd column of key state
'HWAN' : 3rd column of key state
'GBO!' : 4th column of key state
Result
key state
| 48 47 48 47 |
| 57 72 57 72 |
| 41 4f 41 4f |
| 4e 21 4e 21 |
- rotate last column and alter value with S-Box S-Box
| 47 | => | 72 | => | 40 |
| 72 | => | 4f | => | 84 |
| 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)
This project provide basic banking service setup with Go