Skip to main content

AES

Main Source:

Advanced Encryption Standard (AES) is a widely used symmetric encryption algorithm, it is the replacement for DES algorithm. By symmetric encryption, a shared private key is used to encrypt and decrypt the data. AES itself supports 128, 192, or 256-bit key, where the security of an AES system increases exponentially with key length.

  • 128-bit key size: 21282^{128} possible keys, which is approximately 3.4×10383.4 \times 10^{38}.
  • 192-bit key size: 21922^{192} possible keys, which is approximately 6.3×10576.3 \times 10^{57}.
  • 256-bit key size: 22562^{256} possible keys, which is approximately 1.2×10771.2 \times 10^{77}.

The larger the key size, the more combinations an attacker needs to try, which is more resistant to brute-force attacks.

Algorithm

AES operates on fixed block size of 128 bits and operates in a series of transformations applied in multiple rounds, 10, 12, and 14 rounds for 128-bit, 192-bit, 256-bit keys, respectively.

The 128 bits block is structured in a 4×4 matrix from b0tob15b_{0} to b_{15}, typically called the state.

State matrix
Source: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard#Description_of_the_ciphers

AES is based on substitution–permutation network (SPN), it is a way of mixing up and rearranging information. It involves substitution, where certain letters or characters in the block are replaced with different ones, and permutation, where the order of the remaining letters is shuffled or rearranged. This process is done in the rounds of transformations, each round applies the same operations but with different keys that determine the specific substitutions and permutations.

Here is the high-level overview of AES:

  1. Key Expansion: The chosen encryption key is divided into a set of round keys, which will be used in the SPN process. Each word being 32 bits long in AES, 4 words for 128-bit keys, 6 words for 192-bit keys, and 8 words for 256-bit keys.

  2. Initial Round: The input data (plaintext) is combined with the first round key using a bitwise XOR operation.

  3. Rounds: Each round consists of four sub-steps: SubBytes, ShiftRows, MixColumns, and AddRoundKey.

  4. Final Round: The final round omits the MixColumns step and only performs the SubBytes, ShiftRows, and AddRoundKey operations.

The decrypt process is basically the reverse of the encryption process.

In summary, AES structure input data into the state matrix, mix the data which includes permutation and substitution operation, altering the data again with the multiplication of matrix and polynomial arithmetic based on various mathematical properties, and also the bitwise XOR operation. All the process is controlled by the chosen key.

AES algorithm
Source: https://github.com/PitCoder/Cryptography