Intro

AES (Advanced Encryption Standard) is the most common Symmetric key encryption algorithm, which utilizes a block cipher. Unlike DES, the AES algorithm does not use a Feistel network, enabling more parallelization. The length of the key used in AES can be 128 bits, 192 bits, or 256 bits, and can be represented as AES-128, AES-192, and AES-256. Each version also has a different number of rounds, which are 10, 12, and 14 rounds, respectively. In addition, every version of AES uses the same block size, which is 128 bits. AES works on a block array, where each represents 1 byte of the block.

Design

High-level description of AES is as following:

  1. KeyExpansion
  2. For the initial round
    • AddRoundKey
  3. For the other rounds(9, 11, 13 rounds)
    • SubBytes
    • ShiftRows
    • MixColumns
    • AddRoundKey
  4. For the final round
    • SubBytes
    • ShiftRows
    • AddRoundKey

KeyExpansion

The KeyExpansion step generates round keys to be used in each round. In the case of AES-128, KeyExpansion takes a 128-bit key as input and expands it into a 44-word array, with each word being 32 bits. Every 4 words(128 bits) are used as a round key in each round, which means that AES-128 uses 11 round keys. AES-192 and AES-256 uses 13 and 15 round keys respectively. Every round keys are also represented as below.

AddRoundKey

The AddRoundKey step is a simple bitwise XOR operation between the state array and a round key. The state array is a plaintext array at the first round, which is manipulated during the encryption process. Each round key is derived from the original encryption key through the KeyExpansion process. This step is important because adding the key to the state provides the security of encryption.

SubBytes

The SubBytes step substitutes each byte with another byte according to a 8-bit substitution box(Sbox). The S-box provides non-linearity properties, leveraging multiplicative inverse over [Finite Field|GF].

ShiftRows

The ShiftRows step is a transposition step where the rows of the state array are shifted in certain offset cyclically to the left. The first row is left unchanged, the second row is shifted one byte to the left, the third row is shifted two bytes to the left, and the fourth row is shifted three bytes to the left. This step helps in diffusion by mixing the positions of the bytes in each row.

MixColumns

The MixColumns step is a mixing operation that operates on the columns of the state array. Each column is treated as a four-term polynomial and multiplied by a fixed polynomial
modulo . More generally, this step can be represented as below.

This step provides diffusion by mixing the bytes within each column, ensuring that the output bytes are influenced by multiple input bytes.