galois.GF_factory

galois.GF_factory(p, m, prim_poly=None, rebuild=False)[source]

Factory function to construct Galois field array classes of type GF(p^m).

If p = 2 and m = 1, this function will return galois.GF2. If p = 2 and m > 1, this function will invoke galois.GF2m_factory(). If p is prime and m = 1, this function will invoke galois.GFp_factory(). If p is prime and m > 1, this function will invoke galois.GFpm_factory().

Parameters
  • p (int) – The prime characteristic of the field GF(p^m).

  • m (int) – The degree of the prime of the field GF(p^m).

  • prim_poly (galois.Poly, optional) – The primitive polynomial of the field. Default is None which will auto-determine the primitive polynomial.

  • rebuild (bool, optional) – A flag to force a rebuild of the class and its lookup tables. Default is False which will return the cached, previously-built class if it exists.

Returns

A new Galois field class that is a sublcass of galois._GF.

Return type

galois.GF2 or galois.GFp