AES
- Plain text has a fixed length of 128 bits
- Key length can be 128, 192,
256 bits
The picture above shows the arrangement of 16-byte data
Initial round
SubBytes
For example, the picture belowThis is a 4X4 matrix
For example, 19 in the first row and column
The first digit on the left represents the first row obtained from the s box
The number on the right represents the column obtained by s box
So after s box replacement, 19 becomes 4d.
ShiftRows
MixColumns
In the figure below, the two matrices are multiplied together
if you forgot ,please click the link below
https://en.wikipedia.org/wiki/Matrix_multiplication
AddRoundKey
Key expansion
If i is not a multiple of 4, then column i is determined by the following equation:
W[i]=W[i-4]^W[i-1]
If i is a multiple of 4, then column i is determined by the following equation:
W[i]=W[i-4]^T(W[i-1])
Function T consists of 3 parts: word loop, byte substitution and round constant XOR.
Word rotation: rotate 4 bytes in 1 word to the left by 1 byte. That is to say, the input word [b0, b1, b2, b3] is converted into [b1,b2,b3,b0]
Byte substitution: Use S box to perform byte substitution on the result of word loop
Round constant XOR: XOR the results of the first two steps with the round constant Rcon[j], which represents the number of rounds