I am implementing GF(8) Multiplication. Primitive Polynomial is x^3 + x + 1. I know the basics: if multiplication overflows, I can xor it with my primitive polynomial and bring it into the range of finite field.
However the trouble occurs when the overflow occurs for more than one bit. For example: Correct Result: alpha^3(011) * alpha^2(100) in binary results 12(1001). Product overflows and hence doing XOR with primitive polynomial gives the correct value i.e. alpha^5(111). Incorrect Result: alpha^5(111) * alpha^3(011) in binary results 21(10101).Here the result overflows by two bits and doing XOR with primitive polynomial doesn't give the correct result.
What am I missing?