Table of Contents
There are two important notions in MPFQ: the api_extension
and the FieldFamily (also called the TAG).
Their meanings are the following:
In MPFQ, there is a basis API. In some cases, one might
want to define more funtions. We call
api_extension a package of functions that we can
choose to add to the basis API. For instance,
CHAR2 is an api_extension
containing functions we want for fields of characteristic 2.
MGY is another api_extension for
fields in Montgomery representation.
A FieldFamily, or a TAG corresponds
to an implementation of a (possibly reduced to one element)
family of fields. Each FieldFamily have the
feature of the basis API plus the api_extensions
that were chosen to make his use more convinient. Examples of
FieldFamilys are 2_128 that is the
field GF(2^{128}), pm_3 that is for
the family of prime fields for which the modulus fits in 3
words and elements are in Montgomery representation.
Available api_extensions:
CHAR2: fields of characteristic 2
MGY: prime fields in Montgomery representation
POLY: package that provides univariate polynomials
with coefficients in the field
Available FieldFamily:
2_x for x in [2..255].
This gives the finite field GF(2^x) in
polynomial representation with a hard-coded (sparse) defining
polynomial.
p_x for x in [1..9].
This family implements any prime field for which
p fits in x machine words. The
elements are stored in classical representation.
p_x_5 for x in [0..8].
This family implements any prime field for which
p fits in x and a half machine words. The
elements are stored in classical representation.
p_25519. This implements the field
GF(2^{255}-19).
p_127_1. This implements the field
GF(2^{127}-1).
p_127_735. This implements the field
GF(2^{127}-735).
pm_x for x in [1..9].
This family implements any prime field for which
p fits in x machine words. The
elements are stored in Montgomery representation.
pm_x_5 for x in [0..8].
This family implements any prime field for which
p fits in x and a half machine words. The
elements are stored in Montgomery representation.
pf_e where pf is one of the four TAGs p_x, p_x_5, pm_x or pm_x_5. This family implements an extention of the base field implemented through pf. The elements are stored as polynomial with coefficent in the base field.
The FieldFamilys 2_x implement the api_extension CHAR2, pm_x and pm_x_5 implement MGY, and all FieldFamily above implement the api_extension POLY.
To each FieldFamily will correspond a C-type for fields and elements, and a set of functions following the basis API and eventually the api_extension s this family requires. All of them are gathered into a .c and a .h files
named:
mpfq_FieldFamily.c mpfq_FieldFamily.h
Most of the code will actually be inside the .h file, so that the functions get inlined during compilation.