This paper does not explain the theory of wheel function, only a brief introduction

The wheel function mainly contains four kinds of operations, but the specific operation combination of different wheel is not the same. The main difference is the initial Round (Round 0) and the last Round (Round Nr). The operation of all intermediate rounds is the same, and four kinds of operations will be performed successively, namely:

  • [Data obfuscation] SubByte substitution
  • ShiftRow = ShiftRow
  • Mixcolumns
  • [Data encryption] Round key add (AddRoundKey)

According to the definition of Rinjdael algorithm, the number of encryption rounds will choose different values for different groups and different key lengths:

Round iteration number BS=128 bits (standard AES) BS = 192 BS = 256
KS = 128 10 (AES – 128) 12 14
KS = 192 12 (AES – 192) 12 14
KS = 256 14 (AES – 256) 14 14

BS indicates the packet length and KS indicates the key length

SubstituteBytes

SubBytes are operations that replace the input state by finding each independent element in the state matrix in a Substitution box (S-box). Byte substitution is a reversible nonlinear transformation and the only nonlinear transformation in the AES operation group. The reverse byte substitution operation is also accomplished by searching and replacing the reverse substitution box.

S-box is a 16×16 query table calculated strictly according to the design principles, with 256 elements in total, as shown in the figure below:

The s-box is a fixed query table, so the inverse S-box is also a 16×16 fixed query table.

The S-box is constructed from the multiplication inverse and series linear affine transformation over a finite field GF(256), not a simple query table constructed randomly. Due to the complexity of its operation, most of the AES algorithm implementation directly uses the query table, but the query table method is not suitable for all scenarios, such as encounter cannot use the query table scenario (such as hardware storage restrictions), it is necessary to achieve the equivalent of the s-box replacement operation logic.

Row shifts

The main purpose of line shift is to realize the diffusion of bytes in each line, which belongs to linear transformation.

MixColumns

Column mixing is a diffusion over columns by multiplying the state matrix by the constant matrix C, which belongs to the substitution transformation. The most complicated step in Rijndael’s algorithm is column mixing, which is essentially polynomial multiplication in finite field GF(256).

AddRoundKey (AddRoundKey)

Key addition is the operation of the round key with the state matrix, which is a real encryption step.