Mix Column
The "Mix Column" operates on the rows of the 4x4 state matrix.
It is a non-linear operation that involves multiplying each column by a fixed matrix and reducing the result modulo a fixed polynomial.
The fixed matrice is the following :
+-------------+
| 02 03 01 01 |
| 01 02 03 01 |
| 01 01 02 03 |
| 03 01 01 02 |
+-------------+Then the operation is the following :
Fixed matrice User data Result
+-------------+ +-------------+ +-------------+
| 02 03 01 01 | | 00 01 02 03 | | r1 r2 r3 r4 |
| 01 02 03 01 | | 11 12 13 10 | | ... |
| 01 01 02 03 | * | 22 23 20 21 | = | ? |
| 03 01 01 02 | | 33 30 31 32 | | |
+-------------+ +-------------+ +-------------+
Each row of the result are made by the result of the operation of the fixed matrice row times each column :
r1 = ( 02 * 00 ) β ( 03 * 11 ) β ( 01 * 22 ) β ( 01 * 33 )
r2 = ( 02 * 01 ) β ( 03 * 12 ) β ( 01 * 23 ) β ( 01 * 30 )
r3 = ( 02 * 02 ) β ( 03 * 13 ) β ( 01 * 20 ) β ( 01 * 31 )
etc. Because of all operation are a Galois Field multiplication, it is not only a times 2 or 3
Only 3 operators are used into this operation :
1
2
3
It make easier to explain a process to calculate the result of the mix column operation, but keep in mind that it look easy but it is not.
Here is only a limited explanation that do not cover the entire mathematics behavior of this maths tool
All operations are made with the binary forms of the number.
Multiply by 1 is just like standard decimal operation,
a * 1 = aMultiply by 2
Because we work into GF(2^8), the number can't have more than 8 bits, so if there is more after the bit shift, then the number must be xored with 0b0011011
Here is an example with 0xd4 * 2
The xor operation is done only because d4 * 02 >= 100000000
Multiply by 3
Here is an example with 0xd4 * 3
Python implementation
Optimized
Last updated