Expand description
GF(2^16) Galois field arithmetic.
PAR2 mandates the irreducible polynomial 0x1100B:
x^16 + x^12 + x^3 + x + 1
All arithmetic uses log/antilog (exp) tables for O(1) multiply/divide. The generator element is 2 (as per the PAR2 spec).
Functionsยง
- add
- Addition in GF(2^16) is XOR.
- div
- Divide a by b in GF(2^16). Panics if b is 0 (division by zero).
- exp2
- Return 2^exp in GF(2^16). The generator is 2.
- inv
- Multiplicative inverse: inv(a) = a^(FIELD_ORDER-1) = a^65534. Panics if a is 0.
- mul
- Multiply two elements in GF(2^16). Returns 0 if either operand is 0.
- pow
- Raise a to the power exp in GF(2^16).
- sub
- Subtraction in GF(2^16) is the same as addition (XOR).