I'm dealing with Galois fields $GF(2^{8})$ and need help finding a
polynomial $r^{-1}(x)$ such that $r^{-1}(x) r(x) \equiv 1 \mod m(x)$, where:
- $m(x) = x^{8} + x^{4} + x^{3} + x + 1$
- $r(x) = u(x) - q(x) \cdot m(x)$
- $u(x) = s(x) \cdot t(x)$
- $s(x) = x^{7} + x^{5} + x^{4} + x$
- $t(x) = x^{4} + x^{2} + 1$
Thus:
- $u(x) = x^{11} + x^{8} + x^{6} + x^{4} + x^{3} + x$
- $q(x) = x^{3} + 1$
- $r(x) = -x^{7} - x^{4} - x^{3} + 1 \mod 2 = x^{7} + x^{4} + x^{3} + 1$
what I have tried
I've attempted to find out $r^{-1}(x)$ but failed.
Here is what I've tried:
From Euclides's algorithm:
\begin{align*}
u(x) &= q(x) \cdot m(x) + r(x) \\
m(x) &= q_{2}(x) \cdot r(x) + r_{2}(x) \\
&= x \cdot r(x) + (-x^{5} + x^{3} + 1 \mod 2) \\
&= x \cdot r(x) + ( x^{5} + x^{3} + 1) \\
r(x) &= q_{3}(x) \cdot r_{2}(x) + r_{3}(x) \\
&= (x^{2} - 1 \mod 2) \cdot r_{2}(x) + (x^{4} + 2 x^{3} - x^{2} + 2 \mod 2) \\
&= (x^{2} + 1) \cdot r_{2}(x) + (x^{4} + x^{2}) \\
r_{2}(x) &= q_{4}(x) \cdot r_{3}(x) + r_{4}(x) \\
&= x \cdot r_{3}(x) + 1 \\
r_{3}(x) &= q_{5}(x) \cdot r_{4}(x) + r_{5}(x) \\
&= (x^{4} + x^{2}) \cdot r_{4}(x) + 0
\end{align*}
We have:
\begin{align*}
q_{2}(x) &= x \\
q_{3}(x) &= x^{2} + 1 \\
q_{4}(x) &= x \\
q_{5}(x) &= x^{4} + x^{2} \\
r_{2}(x) &= x^{5} + x^{3} + 1 \\
r_{3}(x) &= x^{4} + x^{2} \\
r_{4}(x) &= 1 \\
r_{5}(x) &= 0
\end{align*}
Thus:
\begin{align*}
1 &= r_{4}(x) \\
&= r_{2}(x) - q_{4}(x)r_{3}(x) \\
&= r_{2}(x) - q_{4}(x)\big(r(x) - q_{3}(x)r_{2}(x)\big) \\
&= \big(-q_{4}(x)\big) r(x) +
\big(1 + q_{3}(x)\big) r_{2}(x) \\
&= \big(-q_{4}(x)\big) r(x) +
\big(1 + q_{3}(x)\big) \big(m(x) - q_{2}(x)r(x)\big) \\
&= \Big(-q_{4}(x) - q_{2}(x) - q_{2}(x)q_{3}(x)\Big) r(x) +
\Big(1 + q_{r}(x)\Big) m(x)
\end{align*}
So, we get:
\begin{align*}
r^{-1}(x)
& = - q_{4}(x) - q_{2}(x) - q_{2}(x)q_{3}(x) & \mod 2 \\
& = - x - x - x(x^{2} + 1) & \mod 2 \\
& = - x - x - x^{3} - x & \mod 2 \\
& = - x^{3} - 3x & \mod 2 \\
& = x^{3} + x
\end{align*}
But, this is wrong because when I compute $r^{-1}(x) r(x) \mod m(x)$
the result is not 1