Structure of AES

KeyExpansion

In this phases, the 11 separate 128 bit round_key are derived from our input key (with AES-128). Every one to be used in each AddRoundKey step.

AddRoundKey

The bytes of the first round_key are XOR'd with the bytes of the initial state.

Round

Confusion

Keep others from knowing or understanding what happened.

  1. SubBytes - each byte of the state is substituted for a different byte according to a lookup table (S-box).

    2025-07-30_00-47-24_screenshot.png

    According to Shannon's Information Theory, for the secure cipher, just with given ciphertext, we have no way to learn anything about the key. Otherwise, we can express the relationship between ciphertext and key. For example, the Caesar cipher with ciphertext = plaintext + key relationship.

    For the linear transformations can be solved using techniques like Gaussian elimination. Even low-degree polynomials, e.g. an equation like \(x^4 + 51x^3 + x\) can be solved efficiently by algebraic methods. However, the high-degree of a polynomials can only be approximated by a larger and larger amount of linear functions.

Diffusion

Cause change of one bit in the plaintext to lead to a change as much as possible the bits of the ciphertext

  1. ShiftRows - the last three rows of the state matrix are transposed -> shifted over a column or two or three.

    2025-07-30_13-43-14_screenshot.png

  1. MixColumns - matrix multiplication is performed on the columns of the state, combining the four bytes in each column. This is skipped in the final round.

    2025-07-30_13-55-02_screenshot.png

  1. AddRoundKey - the bytes of the current round_key are XOR'd with the bytes of the state.

Encrypt Flow Chart

aes_encrypt-2025-07-31-1536.svg

Decrypt Flow Chart

aes_decrypt-2025-07-31-1536.svg

Modes of Operation

ECB

2025-07-31_16-07-49_screenshot.png

Property: Blocks encrypt/decrypt independently.

CBC

2025-07-31_16-10-17_screenshot.png

OFB (Stream Cipher)

2025-07-31_16-11-07_screenshot.png

The advantage of stream ciphers is that they can work plaintext of arbitrary length, with no padding required.

CTR (Stream Cipher)

2025-07-31_16-13-23_screenshot.png