Supported Fields
Last updated
Last updated
Here are the kinds of fields supported in Keelung:
Any !
Any larger than or equal to (fields with 17 elements)
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:
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.
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 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
:
You can use any or field you like. Here are some other popular choices: