# Supported Fields

Here are the kinds of fields supported in Keelung:

Any prime field larger than or equal to $GF(17)$ (fields with 17 elements)

## Choice of fields

Commands like compile would ask you to specify which kind of field to use, when compiling the program into the constraint system over that field:

The example above uses `gf181`

, which is actually a *prime field* defined as:

### The `FieldType`

datatype

`FieldType`

datatypeYou can choose another kind of finite field by giving a different `FieldType`

. Here’s how `FieldType`

is declared under the hood:

Both `Prime`

and `Binary`

takes an `Integer`

as the parameter, but we’ll see that they have different meanings.

## Prime fields

Different prime fields have different prime * characteristics*. The

`Integer`

in `Prime`

stands for that prime characteristics.Bad things would happen if you attempt to provide composite (non-prime) numbers as parameters for `Prime`

.

## Binary fields

Binary extension fields, on the other hand, are characterized by * irreducible polynomials*.

These irreducible polynomials can be expressed as numbers, and that’s what the `Integer`

in `Binary`

is for.

Take Rijndael's (AES) finite field `GF(2)[x]/(x⁸ + x⁴ + x³ + x + 1)`

as example, if we represent each term of the polynomial as a bit in a binary number, the irreducible polynomial `x⁸ + x⁴ + x³ + x + 1`

can be encoded in the binary form as `0b100011011`

(or `283`

in decimal). Put this number in `Binary`

and you’ll get a `FieldType`

:

## Examples

You can use any `Prime`

or `Binary`

field you like. Here are some other popular choices:

Last updated