mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 09:01:32 +01:00
new field
This commit is contained in:
25
field/field.go
Normal file
25
field/field.go
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user