0
$\begingroup$

I was studying the mix column transformation in AES and working through an example.

$[\mathtt{02}]\cdot[\mathtt{87}]$ - this multiplication works fine in the polynomial form modulo $x^8+x^4+x^3+x+1$. The polynomial answer to this is $x^4+x^2+1$ which is $\mathtt{0001 0101}$. But if you try to work this in bits, the answer you get is $\mathtt{0001 0100}$. (Multiplying by $2$ is the same as a left shift by $1$ followed by XOR with $\mathtt{00011011}$ if the MSB was $1$ before the shift).

Why is there a difference? Obviously, there shouldn't be a difference... Where am i going wrong?

$\endgroup$

1 Answer 1

3
$\begingroup$

I suspect you got the shift wrong.

Anything shifted left by 1 has an lsbit of 0; if you xor in 010101 (which you do in this case, as the initial value had a 1 msbit), well, 010101 has a 1 lsbit, and the xor of the two must have a 1 lsbit; your result had a 0 lsbit.

Perhaps you're doing a left circular shift (moving bit 7 to bit 0), rather than a left shift (which places a 0 into bit 0)

$\endgroup$
2
  • $\begingroup$ thanks for that...i didn't know lsb needed to be 0 in a left shift. $\endgroup$
    – Fiona
    Commented Feb 8, 2017 at 18:04
  • 2
    $\begingroup$ Think about it: when you multiply something by 2, the lsbit of that result is always 0... $\endgroup$
    – poncho
    Commented Feb 8, 2017 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.