AES Algorithm in detail

Before we start with the algorithm, let's first understand the various terms used in AES: Plaintext: The original message that is to be encrypted. Key: The secret value used to encrypt and decrypt the message. Cipher text: The encrypted message that is produced after applying the algorithm on the plaintext using the key. Round: A complete execution of the algorithm on the plaintext using the key. Now let's move on to the step-by-step explanation of the AES algorithm: Step 1: Key Expansion In this step, the original key is expanded into multiple round keys, which are used in the subsequent rounds. The key expansion algorithm takes the original key and generates a key schedule, which is a series of round keys. Each round key is the same size as the block size. Key Expansion Step 2: Initial Round In the initial round, the algorithm performs a simple XOR operation between the plaintext and the first round key.

Initial Round

Step 3: Main Rounds In the main rounds, the algorithm performs four operations on the data in each round: SubBytes, ShiftRows, MixColumns, and AddRoundKey. SubBytes: In this step, each byte of the block is replaced with a corresponding value from a fixed substitution table called the S-box. ShiftRows: In this step, the bytes in each row of the block are shifted by a certain number of bytes. The first row is not shifted, 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. MixColumns: In this step, each column of the block is multiplied with a fixed matrix. This operation provides additional diffusion of the input data. AddRoundKey: In this step, a portion of the key is XORed with the block. The portion of the key used in each round is called the round key, and is derived from the main key using the key schedule. Step 4: Final Round In the final round, the algorithm performs only three operations: SubBytes, ShiftRows, and AddRoundKey.

Final Round

After the final round, the output of the algorithm is the encrypted data. Decryption is performed by applying the inverse of each of the above operations in reverse order, using the same key. In summary, the AES algorithm is a series of operations performed on the plaintext using the key to generate the cipher text. The algorithm is designed in such a way that it provides strong encryption and is considered secure against all known attacks