Multiplication is usually based on addition. When we have to add value exactly amount of times we can just multiply to get the same value. Can we do it here with Galois addition? No! When we add two identical values together we end up with a neutral element of addition! It's not very crypto when you can simply guess the result!

## Multiplication

Inside Galois Field the multiplication is defined in a very particular way. The moment we see a "" we stop thinking about the number as a binary value, we think about it as a polynomial. Let's take numbers and and write them in binary.

We use the bit values from those numbers to create two polynomials.

And multiply those polynomials.

Now we have to switch it back from the polynomial to a number. First we take all the constants write them down.

Time to make a classical "modulo two" on every digit. This means that we change every even number to , and every odd number to . This leaves is with a large binary number.

The size of the value is a problem because we only have eight bits to store the solution. To solve it we need to use Galois Modulo and our old friend number .

This will become very interesting in next chapter, but first I need to explain another concept.

## Neutral Element

What's the neutral element of Galois Multiplication? I will prove you that it's a vector of eight bits that looks exactly like this

.

Now pay attention! I'm proving it by multiplying two binary values.

Now we change them into polynomials.

And multiply them as above.

When we change it back from polynomial into binary we get again

1 2 3 4 5 6 7 8 9 |
def Multiply(a, b): result = 0; for i in range(31): bit = (a >> i) & 0x1 if bit == 0x1: result ^= (b << i); return GaloisHelper.Modulo(result); |