I'm trying to implement AES as practice for my C++ skills, but I've come across a confusing problem that I think belongs here rather than in a programming discussion forum.
Rijndael's finite field is, with reducing polynomial
There is a step in the algorithm that takes a polynomialwith coefficients in
, and multiplies it by a polynomial
and reduces it modulo
, to get
This operation is equivalent, if a is a constant polynomial, according to the text, to the matrix multiplication:
it gives the constant polynomial as, and the inverse polynomial
(all numbers in curly braces are hexadecimal).
Now, being as I'm using a computer to do this, and proper polynomial handling is hard to do, I'm using the matrix multiplication to do the calculation. Now, if I'm thinking about this properly, then the matrix representations ofand
should have a product that is a unit matrix. But, if my calculations (done by my program) are correct, then:
![]()
Which is almost a unit matrix, but not quite. And, when I use these polynomials to calculate the function, and then the inverse, I get a different polynomial to my input. I checked my matrix multiplication algorithm, it seems to be working fine.
Two other matrices that should have a unit matrix product (for another step in the algorithm) do. I'm definitely doing finite field arithmetic. I'm using a logarithm table for my multiplication, base three, which I know for a fact is a generator. I can't find anything wrong with the procedure, so I'm asking you guys if you could please tell me why it doesn't work.


LinkBack URL
About LinkBacks