pub enum IrreducablePolynomial {
Show 30 variants Poly84310, Poly84320, Poly85310, Poly85320, Poly85430, Poly8543210, Poly86320, Poly8643210, Poly86510, Poly86520, Poly86530, Poly86540, Poly8654210, Poly8654310, Poly87210, Poly87310, Poly87320, Poly8743210, Poly87510, Poly87530, Poly87540, Poly8754320, Poly87610, Poly8763210, Poly8764210, Poly8764320, Poly8765210, Poly8765410, Poly8765420, Poly8765430,
}
Expand description

Represents an irreducable polynomial of GF(2^8).

Each polynomial is named according to the nonzero positions of the coefficients. Each digit after the Poly prefix corresponds to the exponent of the variable for which a nonzero coefficient is present. Recall that in GF(2^x), the only possible coefficients are either 0 or 1.

For example, Poly84310 represents x^8 + x^4 + x^3 + x + 1.

Variants§

§

Poly84310

§

Poly84320

§

Poly85310

§

Poly85320

§

Poly85430

§

Poly8543210

§

Poly86320

§

Poly8643210

§

Poly86510

§

Poly86520

§

Poly86530

§

Poly86540

§

Poly8654210

§

Poly8654310

§

Poly87210

§

Poly87310

§

Poly87320

§

Poly8743210

§

Poly87510

§

Poly87530

§

Poly87540

§

Poly8754320

§

Poly87610

§

Poly8763210

§

Poly8764210

§

Poly8764320

§

Poly8765210

§

Poly8765410

§

Poly8765420

§

Poly8765430

Implementations§

Converts the IrreducablePolynomial to its binary representation.

In GF(2^x), coefficients in the extension polynomial may only take values of 0 or 1. As a result, there is a natural mapping of values in GF(2^x) to bits. 0b1011 maps to x^3 + x^1 + 1, for example. The greatest degree that can be encoded by an eight-bit byte is 7, as a consequence of the least significant bit being treated as x^0 == 1. In order to represent a degree 8 polynomial, there must be at least 9 bits available, so it can be encoded as a 16-bit value.

Determines whether the IrreducablePolynomial is a primitive polynomial.

In GF(2^x) wherein arithmetic operations are performed modulo a polynomial, the polynomial is said to be primitive if for some alpha, each nonzero member value of the field can be uniquely represented by alpha ^ p for p < 2^x, where alpha is a root of the polynomial. That is, for some root of the polynomial, every member of the field can be represented as the exponentiation of said root.

In GF(2^x), the only nontrivial prime root of any given IrreducablePolynomial is two. We say “is primitive” as a shorthand for meaning that the IrreducablePolynomial is primitive assuming a root of two.

The use of primitive polynomials confers an immediate performance benefit for single values: we can represent multiplication and division as addition and subtraction within logarithms and exponents. Additionally, some usages of Galois fields, e.g. Reed-Solomon syndrome coding, require primitive polynomials to function properly.

This method consults the PRIMITIVES table to determine if the IrreducablePolynomial is actually primitive. That is to say,

poly.is_primitive() == PRIMITIVES.binary_search(&poly).is_ok()

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.