How AES works

During AES algorithm processing, a 4 x 4 array of bytes known as the state is modified using multiple rounds. Full encryption requires 10 to 14 rounds, depending on the size of the key. The following table shows the key sizes and the required number of rounds:

Key size

Number of rounds required


10 rounds


12 rounds


14 rounds


Once the state is initialized with the input to the cipher, four operations are performed in four stages to encrypt the input. These stages are: AddRoundKey, SubBytes, ShiftRows, and MixColumns:

  1. In the AddRoundKey step, the state array is XOR'd with a subkey, which is derived from the master key
  2. SubBytes is the substitution step where a lookup table (S-box) ...

Get Advanced Blockchain Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.