arnaucube
arnaucube/gnark-plonky2-verifierPublic Self-hosted repository
new field
jtguibas jtguibas@gmail.com
Mon, 10 Oct 2022 18:00:19 -0700
commit

831eb8bf9f8c6ab91f162bde343fff59d6cf66b5

parent

a058df60992cade468db0f6545d8006219fdf7c5

1 files changed, 25 insertions(+), 0 deletions(-)

jump to
A field/field.go

@@ -0,0 +1,25 @@

+package field + +import ( + "github.com/consensys/gnark-crypto/ecc" + "github.com/consensys/gnark/frontend" + "github.com/consensys/gnark/std/math/emulated" +) + +type EmulatedField = emulated.Goldilocks +type F = emulated.Element[EmulatedField] +type Hash = [4]F + +var TEST_CURVE = ecc.BN254 + +func NewFieldElement(x uint64) F { + return emulated.NewElement[EmulatedField](x) +} + +func NewFieldAPI(api frontend.API) frontend.API { + field, err := emulated.NewField[EmulatedField](api) + if err != nil { + panic(err) + } + return field +}