goldilocks and poseidon

This commit is contained in:
jtguibas
2022-10-07 16:59:02 -07:00
parent 7d2af3d789
commit 96bfd45884
8 changed files with 1843 additions and 242 deletions

20
goldilocks/goldilocks.go Normal file
View File

@@ -0,0 +1,20 @@
package goldilocks
import (
"github.com/consensys/gnark/frontend"
"github.com/consensys/gnark/std/math/emulated"
)
type GoldilocksElement = emulated.Element[emulated.Goldilocks]
func NewGoldilocksElement(x uint64) GoldilocksElement {
return GoldilocksElement(emulated.NewElement[emulated.Goldilocks](x))
}
func NewGoldilocksAPI(api frontend.API) frontend.API {
goldilocks, err := emulated.NewField[emulated.Goldilocks](api)
if err != nil {
panic(err)
}
return goldilocks
}