12 private readonly
byte[] coefficients;
13 private readonly
int degree;
24 this.degree = this.coefficients.Length - 1;
41 byte[] C =
new byte[this.degree + P.degree + 1];
44 for (i = 0; i <= P.degree; i++)
46 for (j = 0; j <= this.degree; j++)
47 C[i + j] ^=
GF256.
Multiply(
this.coefficients[j], P.coefficients[i]);
61 if (this.degree < Divisor.degree)
64 if (Divisor.coefficients[0] != 1)
65 throw new NotSupportedException(
"Leading coefficien must be 1.");
67 byte[] C = (
byte[])this.coefficients.Clone();
71 c = this.degree - Divisor.degree;
72 for (i = 0; i <= c; i++)
79 for (j = 1; j <= Divisor.degree; j++)
83 byte[]
Residue =
new byte[Divisor.degree];
84 Buffer.BlockCopy(C, c + 1,
Residue, 0, Divisor.degree);
Class representing arithmentic over the Galois Field GF(256) ~ ~ Z2[x]/P(x) over some irreducible pol...
static byte Multiply(byte x, byte y)
Multiplies two numbers
Polynomial over GF(256), where coefficients are defined as bytes in a byte array (Least significant b...
GF256Px(byte[] Coefficients)
Polynomial over GF(256), where coefficients are defined as bytes in a byte array (Least significant b...
GF256Px Multiply(GF256Px P)
Multiplies the polynomial with the polynomial defined by P .
GF256Px Residue(GF256Px Divisor)
Calculates the residue of the polynomial devision of this polynomial, with a divisor in Divisor .
byte[] Coefficients
Polynomial coefficients.