Field types
Although Keelung programs can work with any type of field, it's crucial to indicate the specific field to be used during the compilation of Keelung programs into constraint systems.
stack repl
> compile gf181 echo [] [2]
The example above uses
gf181
, which is defined as:-- | Prime field of order 181
gf181 :: FieldType
gf181 = Prime 1552511030102430251236801561344621993261920897571225601
The choice of field can be constructed with these constructors:
-- | Runtime data for specifying field types
data FieldType
= -- | Binary fields
Binary Integer
| -- | Prime fields
Prime Integer
-- | Binary field of 64 bits
b64 :: FieldType
b64 = Binary 18446744073709551643
-- | For Barreto-Naehrig curve of 128 bits
bn128 :: FieldType
bn128 = Prime 21888242871839275222246405745257275088548364400416034343698204186575808495617
Last modified 24d ago