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

Correct BN254 DST #548

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pairing/bn254/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,31 +235,31 @@ func mapToPoint(domain []byte, u *gfP) kyber.Point {
tv1 := &gfP{}
tv1.Set(u)
gfpMul(tv1, tv1, tv1)
gfpMul(tv1, tv1, c1)
gfpMul(tv1, tv1, c1) // tv1 = u^2 * g(Z)
tv2 := &gfP{}
gfpAdd(tv2, newGFp(1), tv1)
gfpAdd(tv2, newGFp(1), tv1) // tv2 = 1 + tv1
negTv1 := &gfP{}
gfpNeg(negTv1, tv1)
gfpAdd(tv1, newGFp(1), negTv1)
gfpAdd(tv1, newGFp(1), negTv1) // tv1 = 1 - tv1
tv3 := &gfP{}
gfpMul(tv3, tv1, tv2)
tv3.Invert(tv3)
tv3.Invert(tv3) // tv3 = inv0(tv1 * tv2)
tv5 := &gfP{}
gfpMul(tv5, u, tv1)
gfpMul(tv5, tv5, tv3)
gfpMul(tv5, tv5, c3)
gfpMul(tv5, tv5, c3) // tv5 = u * tv1 * tv3 * tv4
x1 := &gfP{}
gfpSub(x1, c2, tv5)
gfpSub(x1, c2, tv5) // x1 = -Z / 2 - tv5
x2 := &gfP{}
gfpAdd(x2, c2, tv5)
gfpAdd(x2, c2, tv5) // x2 = -Z / 2 + tv5
tv7 := &gfP{}
gfpMul(tv7, tv2, tv2)
gfpMul(tv7, tv2, tv2) // tv7 = tv2^2
tv8 := &gfP{}
gfpMul(tv8, tv7, tv3)
gfpMul(tv8, tv7, tv3) // tv8 = tv2^2 * tv3
x3 := &gfP{}
gfpMul(x3, tv8, tv8)
gfpMul(x3, c4, x3)
gfpAdd(x3, newGFp(1), x3)
gfpMul(x3, tv8, tv8) // x3 = tv8^2
gfpMul(x3, c4, x3) // x3 = c4 * x3
gfpAdd(x3, newGFp(1), x3) // x3 = 1 + x3

var x *gfP
y := &gfP{}
Expand Down
4 changes: 2 additions & 2 deletions pairing/bn254/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ type Suite struct {
}

func newDefaultDomainG1() []byte {
return []byte("BN254G1_XMD:KECCAK-256_SSWU_RO_")
return []byte("BN254G1_XMD:KECCAK-256_SVDW_RO_")
}

func newDefaultDomainG2() []byte {
return []byte("BN254G2_XMD:KECCAK-256_SSWU_RO_")
return []byte("BN254G2_XMD:KECCAK-256_SVDW_RO_")
}

// NewSuite generates and returns a new BN254 pairing suite.
Expand Down
Loading