mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 18:37:26 +08:00
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete * 2.1.0 main node rollup
43 lines
573 B
Go
43 lines
573 B
Go
// -*- go -*-
|
|
|
|
package main
|
|
|
|
type FieldElement [2]int32
|
|
|
|
var zero FieldElement
|
|
|
|
func FeZero(fe *FieldElement) {
|
|
copy(fe[:], zero[:])
|
|
}
|
|
|
|
func FeOne(fe *FieldElement) {
|
|
FeZero(fe)
|
|
fe[0] = 1
|
|
}
|
|
|
|
func FeCopy(dst, src *FieldElement) {
|
|
copy(dst[:], src[:])
|
|
}
|
|
|
|
type ProjectiveGroupElement struct {
|
|
X, Y, Z FieldElement
|
|
}
|
|
|
|
func (p *ProjectiveGroupElement) Zero() {
|
|
FeZero(&p.X)
|
|
FeOne(&p.Y)
|
|
FeOne(&p.Z)
|
|
}
|
|
|
|
// @Test 0 0 = 2
|
|
func main(a, b int32) int {
|
|
var pge ProjectiveGroupElement
|
|
|
|
pge.Zero()
|
|
|
|
var y FieldElement
|
|
FeCopy(&y, &pge.Y)
|
|
|
|
return pge.X[0] + y[0] + pge.Z[0]
|
|
}
|