I'm given the problem of computing $x^n$ using multiply-and-square, ie finding $x^1$, $x^2$, $x^4$, etc.
I'm given an irreducible polynomial in $Z_2[x]$, $x^4 + x + 1$. I'm trying to understand if I'm doing this right. To start (and help me out), I've generated a list of 16 elements that comprise the field - $0$, $1$, $x$, $x + 1$, $x^2$, ..., $x^3 + x^2 + x$, $x^3 + x^2 + x + 1$.
The first couple of squares exist in the field, so no work is to be done. The first problem I hit is $x^4$. Here is my work so far:
$x^4 = x^4\ mod\ x^4+x + 1 = 1 * (x^4 + x + 1) - x - 1$.
From what I understand, the $1 * (x^4 + x + 1)$ part will cancel and I'm left with $-x - 1$. However, $-x - 1$ is not in my list of elements. From my understanding, I take each coefficient and $mod\ 2$, since we are in $Z_2$? Suppose we are in $Z_3$ - would I take $mod\ 3$?
If I take $mod\ 2$, I get $x + 1$, which is in my list of elements.
Take the next one as well, $x^8$ (assuming $x^4 = x + 1$).
$x^8 = x^4 * x^4 = (x+1) * (x + 1) = x^2 + 2x + 1 = x^2 + 1$
Am I going about this right? I'm wondering how I can tell what modulo to take the coefficients with, and what modulo to take the exponents with pretty much. thank you