- property galois.GF2.is_primitive_poly : bool
Indicates whether the
irreducible_polyis a primitive polynomial.Notes¶
If the irreducible polynomial is primitive, then \(x\) is a primitive element of the finite field.
Examples¶
The default \(\mathrm{GF}(2^8)\) field uses a primitive polynomial.
In [1]: GF = galois.GF(2**8) In [2]: print(GF.properties) Galois Field: name: GF(2^8) characteristic: 2 degree: 8 order: 256 irreducible_poly: x^8 + x^4 + x^3 + x^2 + 1 is_primitive_poly: True primitive_element: x In [3]: assert GF.is_primitive_polyThe \(\mathrm{GF}(2^8)\) field from AES uses a non-primitive polynomial.
In [4]: GF = galois.GF(2**8, irreducible_poly="x^8 + x^4 + x^3 + x + 1") In [5]: print(GF.properties) Galois Field: name: GF(2^8) characteristic: 2 degree: 8 order: 256 irreducible_poly: x^8 + x^4 + x^3 + x + 1 is_primitive_poly: False primitive_element: x + 1 In [6]: assert not GF.is_primitive_poly