Skip to content

ghkdqhrbals:AES(Advanced Encryption Standard)

Hwangbo Gyumin edited this page Jun 5, 2022 · 1 revision

AES

has symmetric key, symmetric block cypher

  1. Key generation
  2. 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

  1. 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
  1. 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 |

  1. rotate last column and alter value with S-Box S-Box
스크린샷 2022-06-04 오후 4 44 42

| 47 | => | 72 | => | 40 |

| 72 | => | 4f | => | 84 |

| 4f | => | 21 | => | fd |

| 21 | => | 47 | => | a0 |

Result

sub byte column

| 40 |

| 84 |

| fd |

| a0 |

  1. [1st column key state] XOR [last sub byte column] XOR [1st column RCON] = [1st column KEY]

RCON 스크린샷 2022-06-04 오후 4 59 04

| 48 | | 40 | | 01 |

| 57 | | 84 | | 00 | XOR XOR | 41 | | fd | | 00 |

| 4e | | a0 | | 00 |

Result

| 79 |

| d3 |

| bc |

| ee |

  1. [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

  1. FINALLY!

We now have CYPHER KEY 1~10

Rounds


  1. Initial Round

[Pain Text(128 bit)] XOR [CYPHER KEY 1] = initial STATE

  1. 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

  1. 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

Clone this wiki locally