# Matrix multiplication in AES' MixColumns step.

In Advanced Encryption Std, say after a ShiftRow operation, I want to perform MixColumns.

      State             MixColumn Matrix             Mixed
┏             ┓       ┏             ┓       ┏             ┓
┃ d4 e0 b8 1e ┃       ┃ 02 03 01 01 ┃       ┃ 04 e0 48 28 ┃
┃ bf b4 41 27 ┃       ┃ 01 02 03 01 ┃       ┃ 66 cb f8 06 ┃
┃ 5d 52 11 98 ┃       ┃ 01 01 02 03 ┃       ┃ 81 19 d3 26 ┃
┃ 30 ae f1 e5 ┃       ┃ 03 01 01 02 ┃       ┃ e5 9a 7a 4c ┃
┗             ┛       ┗             ┛       ┗             ┛


Example taken from this flash file. I'm puzzled by the description at Wikipedia.

The flash told that after MixColumns, the 1st column of State is turned into the 1st column of the Mixed matrix. How is this so?

First of all, how to multiply a column by a matrix? The shapes don't match, or is there anything special in cryptography? Well, if we transpose the column, I still don't understand: ($\cdot$ means dot product, and here are my Attempts)

# 1: [d4 bf 5d 30]$\cdot$[02 01 01 03] = d4+d4+bf+5d+30+30+30 = 54 != 04

# 2: [d4 bf 5d 30]$\cdot$[02 01 01 03] = d4+d4+bf+5d+((30<<1) ^ 30) = 14 != 04

# 3: [d4 bf 5d 30]$\cdot$[02 03 01 01] = d4+d4+bf+bf+bf+5d+30 = 72 != 04

# 4: [d4 bf 5d 30]$\cdot$[02 03 01 01] = d4+d4+((bf<<1)^30)^11b+5d+30 = 0F != 04

What's happening?

-
11b here means 0x11b. I'm not sure if it's what Wikipedia means. ^ is xor. –  FrenzY DT. Dec 1 '12 at 5:06

All the matrix entries are elements of the Galois field $GF(2^8)$, using field poynomial $x^8 + x^4 + x^3 + x + 1$. There is an excellent Wikipedia article Rijndael mix columns which explains this very clearly.
Thank you, it worked! But what is a Galois field, and what's the magic about $+$ being $\oplus$ and that polynomial? –  FrenzY DT. Dec 1 '12 at 8:34