AES Maths (Rijndael multiplication)

I’m currently fighthing with some AES maths and just figured how to properly calculate the modulo of the polynominal calculations in AES (Rijndael). The encryption algorithm uses that calculation in the SubBytes and MixColumns operation within each round. Actually, the final round of the 10 rounds specified in AES does not run the MixColumns operation.  However, multiplications in Rijndaels GF(28) are basically multiplications modulo m(x) whereby the “Rijndael polinominal” m(x)=x8+x4+x3+x+1. Thus a multiplication in AES works as follows:

Basic multiplication:

(x6+x4+x2+x+1)·(x7+x+1)
x13+x11+x9+x8+x7+x7+x5+x3+x2+x+x6+x4+x2+x+1 = 
x13+x11+x9+x8+x5+x6+x4+x3+1

Modulo calculation:

(x13+x11+x9+x8+x5+x6+x4+x3+1) mod m(x) =
(x13+x11+x9+x8+x5+x6+x4+x3+1) mod (x8+x4+x3+x+1) = x7+x6+1
– (x13+x9+x8+x6+x5) note, this line is x5·m(x)
        x11+x4+x3+1
        – (x11+x7+x6+x4+x3note, this line is x3·m(x)
                x7+x6+1

Finally, the result and its binary representation of the multiplication in GF(28) is:

(x6+x4+x2+x+1)·(x7+x+1) = x7+x6+1
01010111 
· 10000011 =  11000001

Leave a comment