Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added HashToG2 circuit for BLS12-381 #481

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions ecc/bls12-377/hash_to_g2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions ecc/bls12-381/hash_to_g2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions internal/generator/ecc/template/sswu.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,19 @@ func {{$CurveName}}SqrtRatio(z *{{$CoordType}}, u *{{$CoordType}}, v *{{$CoordTy
return isQNr
}

{{if eq $TowerDegree 2 }}
func {{$CurveTitle}}SqrtRatio(z0, z1, u0, u1, v0, v1 *fp.Element) uint64 {
var z {{$CoordType}}
u := {{$CoordType}}{A0: *u0, A1: *u1}
v := {{$CoordType}}{A0: *v0, A1: *v1}
ret := {{$CurveName}}SqrtRatio(&z, &u, &v)
*z0 = z.A0
*z1 = z.A1

return ret
}
{{end}}

func {{$CurveName}}NotOne(x *{{$CoordType}}) uint64 {
{{if eq $TowerDegree 1 }}
var one {{$CoordType}}
Expand Down