Browse Source

new field

main
jtguibas 3 years ago
parent
commit
831eb8bf9f
1 changed files with 25 additions and 0 deletions
  1. +25
    -0
      field/field.go

+ 25
- 0
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
}

Loading…
Cancel
Save