written 6.1 years ago by |
AES ( Advanced Encryption Standard)
The need for coming up with AES algorithm was because of the weakness in DES. The 56 bit key of DES was no longer considered safe against attacks based on exhaustive key search and the 64 bit blocks were also considered weak.
AES is based on 128-bit blocks with 128- bits keys i,e the plaintext size is 128 bits and key size is also 128 bits.
No of rounds in AES are 10, 12 or 14
It works on byte and not on a single bit
Since it works on bytes we say that 128 bit key size = 16 byte and 128 bit plain text = 16 byte
Cipher function has four transformations:
◦ Substitute bytes
◦ Shift rows
◦ Mix columns
◦ Add round key
- It works in two phases
$\hspace{2.5cm}$a. One time initialization on key and plaintext
$\hspace{2.5cm}$b. Actual rounds
1. One time initialization(OTI):
- As AES requires 10 rounds it while need 10 keys and 1 more key for OTI
- In all eleven keys are required
- So the 16 byte key is expanded to get the actual block ie the 16 byte key is expanded into a key containing 4*4 entries
- Out of the 11 keys 1 key is used for OTI and the remaining 10 keys are used for 10 rounds
- The next step is to take the plaintext block called as state and represented into a 4*4 matrix.
- While copying the elements in the matrix the order should be column-wise
Plaintext
Now the 4 X4 initialization key is XORed with the 4 X 4 plaintext block (state Array)
After XORing we get an initial input of size 4 X 4 which is carried forward to the rest of round.
2. Processes in each Round:
a. Apply S box to each of the plaintext bytes: The contents of the state array are locked up into the S box. Byte by byte substitution is done to replace the contents of the state array with the respective entries in the S-box. (only one S box is used)
b. Rotate row ‘K’ of the plaintext (ie state) block by k byte: Each of the four rows of the state array are rotated to the left.
$\hspace{2.5cm}$ Row ‘o’ is rotated 0 bytes (i.e. not rotated at all)
$\hspace{2.5cm}$ Row ‘1’ is rotated 1 bytes
$\hspace{2.5cm}$ Row ‘2’ is rotated 2 bytes
$\hspace{2.5cm} $Row ‘3’ is rotated 3 bytes
This helps us in diffusion of data.
3. Perform a mix Columns Operation:
Now each column is mixed independent of other. Matrix multiplication is used. The output of this step is the matrix multiplication of the old values and constant mix.
Multiplication is performed one column at a time (i.e. 4 bytes at a time), each value in the column is eventually multiplied against every value of the matrix (i.e. 16 total multiplications are performed)
The results of these multiplications are XORed together to produce only 4 resulting bytes for next state.
Finally we have 4 bytes of i/p, 16 multiplication, 12 XORs and 4 bytes of output. e.g., Multiplication Matrix
The first result byte is calculated by multiplying the same four values of the state column with four values of first row of the matrix ,the result of each multiplication is then XORed to produce one byte. e.g. $$\hspace{2.5cm} b_1=(b_1\times2)XOR (b_2\times3)XOR (b_3\times1) XOR(b_4\times1)$$
The second result byte is calculated by multiplying the same four values of the state column with four values of second row of the matrix ,the result of each multiplication is then XORed to produce one byte. e.g. $$\hspace{2.5cm} b_2=(b_1\times1)XOR (b_2\times2)XOR (b_3\times3) XOR(b_4\times1)$$
The third result byte is calculated by multiplying the same four values of the state column with four values of third row of the matrix ,the result of each multiplication is then XORed to produce one byte. e.g. $$\hspace{2.5cm} b_3=(b_1\times1)XOR (b_2\times1)XOR (b_3\times2) XOR(b_4\times3)$$
Similarly fourth result is calculated as
$$\hspace{2.5cm}b_4=(b_1\times3)XOR (b_2\times1)XOR (b_3\times1) XOR(b_4\times2)$$This procedure is repeated again with the next column of the state until there are no more state columns
Then XOR the state with the key block to produce ciphertext. This is the ciphertext for round 1. The entire process is repeated for all the 10 rounds.
Thus,
The overview of the AES Structure is given as: