[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.1 Representation of finite fields

On Asir GF(p), GF(2^n), GF(p^n) can be defined, where GF(p) is a finite prime field of charateristic p, GF(2^n) is a finite field of characteristic 2 and GF(p^n) is a finite extension of GF(p). These are all defined by setmod_ff().

[0] P=pari(nextprime,2^50);
[1] setmod_ff(P);
[2] field_type_ff();
[3] load("fff");
[4] F=defpoly_mod2(50);
[5] setmod_ff(F);
[6] field_type_ff();
[7] setmod_ff(x^3+x+1,1125899906842679);
[8] field_type_ff();
[9] setmod_ff(3,5);
[10] field_type_ff();

If p is a positive integer, setmod_ff(p) sets GF(p) as the current base field. If f is a univariate polynomial of degree n, setmod_ff(f) sets GF(2^n) as the current base field. GF(2^n) is represented as an algebraic extension of GF(2) with the defining polynomial f mod 2. Furthermore, finite extensions of prime finite fields can be defined. See section Types of numbers. In all cases the primality check of the argument is not done and the caller is responsible for it.

Correctly speaking there is no actual object corresponding to a ’base field’. Setting a base field means that operations on elements of finite fields are done according to the arithmetics of the base field. Thus, if operands of an arithmetic operation are both rational numbers, then the result is also a rational number. However, if one of the operands is in a finite field, then the other is automatically regarded as in the same finite field and the operation is done in the finite field.

A non zero element of a finite field belongs to the number and has object identifier 1. Its number identifier is 6 if the finite field is GF(p), 7 if it is GF(2^n).

There are several methods to input an element of a finite field. An element of GF(p) can be input by simp_ff().

[0] P=pari(nextprime,2^50);
[1] setmod_ff(P);
[2] A=simp_ff(2^100);
[3] ntype(@@);

In the case of GF(2^n) the following methods are available.

[0] setmod_ff(x^50+x^4+x^3+x^2+1);
[1] A=@;
[2] ptogf2n(x^50+1);
[3] simp_ff(@@);
[4] ntogf2n(2^10-1);

Elements of finite fields are numbers and one can apply field arithmetics to them. @ is a generator of GF(2^n) over GF(2). See section Types of numbers.

[ << ] [ < ] [ Up ] [ > ] [ >> ]

This document was generated on December 9, 2022 using texi2html 5.0.