Add Key
The AddKey operation is a step in the encryption and decryption processes that involves combining the state matrix with a round key using a XOR operation.
The round key is generated from the original secret key using the Key Schedule, which generates a sequence of subkeys for each round of the cipher.
The AddKey operation is performed by taking each byte of the state matrix and XORing it with the corresponding byte of the round key.
The AddKey operation is denoted as follows:
Let's take an example to see how the AddKey operation works. Suppose we have the following state matrix:
And this round key :
To perform the AddKey operation, we XOR each byte of the state matrix with the corresponding byte of the round key. For example, the first byte of the state matrix is XORed as follows:
After performing the XOR operation for each byte, the resulting state matrix becomes:
Python implementation
Last updated