<< Galois Fields Galois Fields Fields >>

Galois Fields >> Galois Fields > galois_fields

galois_fields

Overview of the Galois Fields toolbox: finite fields GF(p) and GF(p^n)

Description

The galois_fields toolbox works with finite (Galois) fields GF(p) and GF(p^n), and with polynomials over GF(p). It provides:

Fields of order p^n are built from a primitive polynomial f of degree n over GF(p). If α is a root of f, every non-zero element of the field is a power α^k, 0 ≤ k ≤ p^n - 2, and also a polynomial in α of degree < n with coefficients in GF(p).

Data conventions

Polynomials over GF(p) are row vectors of integer coefficients in 0 .. p-1, constant term first: [1 1 0 0 1] is 1 + x + x⁴. Functions that return polynomials trim them to their degree, and return the zero polynomial as 0.

A field is the list returned by gf_create_field: list(p, n, f, elements), where f is the primitive polynomial (n + 1 coefficients) and elements the table of all the elements of the field.

Elements of GF(p) are integers 0 .. p-1. Elements of GF(p^n), n > 1, are rows of n coefficients (polynomials in α, constant term first). Functions on elements accept several elements at once: a matrix for n = 1, one element per row for n > 1.

In the element table of GF(p^n), n > 1, row 1 is the zero element and row k + 2 is α^k (exponential order). For n = 1 the table is 0:p-1.

Limits

The field order p^n can be at most 2^20 (1 048 576) and the degree n at most 20. Element tables have p^n rows, so large fields use memory accordingly.

Building and loading

Run exec builder.sce in the toolbox folder once (a C compiler is required), then exec loader.sce in each session where the toolbox is needed. The help pages are built only when Scilab runs with its Java interface (not with scilab-cli).

Examples

// GF(16) built from the default primitive polynomial 1 + x + x^4
F = gf_create_field(2, 4);
gf_primitive_polynomial(F)        // 1 + x + x^4

a = [0 1 0 0];                    // alpha
b = [1 1 0 0];                    // 1 + alpha = alpha^4
c = gf_multiply(F, a, b)          // [0 1 1 0] = alpha + alpha^2
gf_to_exponential(F, c)           // 5: c is alpha^5

// Polynomials over GF(2)
[r, q] = gf_poly_divide([1 0 1 1], [1 1], 2)   // r = 1, q = [0 0 1]

See also

History

VersionDescription
2.0.0

Refactoring of the function/toolbox.


Report an issue
<< Galois Fields Galois Fields Fields >>