2

I know that in GF(128) $a + b = a \oplus b$.

I have an multiplication table for GF(128). In this table $7\cdot 5 = 27$. How can I create table like this?

Jyrki Lahtonen
  • 133,153

1 Answers1

4

In general the multiplication depends on what defining polynomial you use. For the example that you give that is not immediately needed as the factors have such a low degree. My educated guess is that whoever gave that table is internally using a monomial presentation, and converts the sequence of coefficients to integers. Thus $7=111_2$ truly means the coset of the polynomial $$1\cdot x^2+1\cdot x+1=x^2+x+1$$ (modulo some ideal $I$ of the ring $\Bbb{Z}_2[x]$). Similarly $$5=101_2=1\cdot x^2+0\cdot x+1=x^2+1.$$ Therefore their product is the coset of $$ \begin{aligned} "7"\cdot"5"&=(x^2+1)(x^2+x+1)=(x^4+x^3+x^2)+(x^2+x+1)\\ &=x^4+x^3+2x^2+x+1\\ &=x^4+x^3+x+1, \end{aligned} $$ because the arithmetic of the coefficiente of polynomials is done modulo two. Note that $x^4+x^3+x+1$ corresponds to $11011_2=27$.

You get the field $GF(128)$ if you do all the arithmetic as polynomials of degree at most six modulo two and reduce the high degree ($\ge7$) terms using the defining polynomial of degree seven (that seven comes from $128=2^7$). I usually use $x^7+x^3+1$ when I need $GF(128)$. This means that (for example) $$ x^4\cdot x^3=x^7=x^7+(x^7+x^3+1)=2x^7+x^3+1=x^3+1, $$ so $"16"\cdot"8"=1001_2="9"$, and $$ x^4\cdot x^5=x^9=x^9+x^2(x^7+x^3+1)=2x^9+x^5+x^2=x^5+x^2, $$ so $"16"\cdot"32"=x^5+x^2=100100_2="36"$.

In other words you declare that $x^7=x^3+1$, use that and all its consequences such as $x^8=x^4+x$, $x^9=x^5+x^2$ et cetera.

Jyrki Lahtonen
  • 133,153
  • Thank you. But in what book there are algorithms for this? – eremelis Apr 20 '14 at 06:40
  • If your background is engineering or computer science, then some (many) colleagues think highly of Mullen's book. I haven't looked at it myself, but I trust their word. If your needs are very limited, then that book may be too much. I believe you can easily find C-code for doing the arithmetic in $GF(256)$, because it is needed in Rijndael (=AES) crypto standard. There a degree eight defining polynomial is used instead of degree seven as here, so you need to make some changes... – Jyrki Lahtonen Apr 20 '14 at 06:53