One full AES round
Now let's combine all the parts. AES-128 has 10 rounds, and each (full) round works in the following order:
- AddRoundKey — XORing the state with the round key
- SubBytes — substitution via S-box
- ShiftRows — shifting rows
- MixColumns — mixing columns
- AddRoundKey — XOR with the next round key
For decryption, all steps are performed in reverse order and with inverse operations. Each step individually is easily reversed — the strength of AES lies in the 10 times repetition of these steps.
We have only one round. The attached raund.py file fully provides the forward direction (you can run it to check your own code).
Round keys:
k0 = 8884c3cfc8d1725a8cf59654f5d659c7
k1 = 877e985cacb1bac93f756f24db623d52
Result after one round (hex):
1fc8652c216ebb53719ecff2078cc98f
Recover the original 16 bytes (readable ASCII text) and assemble the flag:
BAYROQ{A3S_<16 belgi>}
Reverse order: AddRoundKey(k1) -> InvMixColumns -> InvShiftRows -> InvSubBytes -> AddRoundKey(k0). AddRoundKey is its own inverse, because it is simply XOR.