Browse Source

Fix use H polynomial

ed255-patch-1
arnaucube 4 years ago
parent
commit
198eeee493
1 changed files with 1 additions and 5 deletions
  1. +1
    -5
      prover.go

+ 1
- 5
prover.go

@ -2,7 +2,6 @@ package gocircomprover
import ( import (
"crypto/rand" "crypto/rand"
"fmt"
"math/big" "math/big"
bn256 "github.com/ethereum/go-ethereum/crypto/bn256/cloudflare" bn256 "github.com/ethereum/go-ethereum/crypto/bn256/cloudflare"
@ -91,9 +90,7 @@ func GenerateProof(pk *ProvingKey, w Witness) (*Proof, []*big.Int, error) {
proofBG1 = new(bn256.G1).Add(proofBG1, pk.VkBeta1) proofBG1 = new(bn256.G1).Add(proofBG1, pk.VkBeta1)
proofBG1 = new(bn256.G1).Add(proofBG1, new(bn256.G1).ScalarMult(pk.VkDelta1, s)) proofBG1 = new(bn256.G1).Add(proofBG1, new(bn256.G1).ScalarMult(pk.VkDelta1, s))
// TODO
// h := calculateH(pk, w)
h := []*big.Int{} // TMP
h := calculateH(pk, w)
for i := 0; i < len(h); i++ { for i := 0; i < len(h); i++ {
proof.C = new(bn256.G1).Add(proof.C, new(bn256.G1).ScalarMult(pk.HExps[i], h[i])) proof.C = new(bn256.G1).Add(proof.C, new(bn256.G1).ScalarMult(pk.HExps[i], h[i]))
@ -117,7 +114,6 @@ func calculateH(pk *ProvingKey, w Witness) []*big.Int {
for i := 0; i < pk.NVars; i++ { for i := 0; i < pk.NVars; i++ {
for j := range pk.PolsA[i] { for j := range pk.PolsA[i] {
polAT[j] = fAdd(polAT[j], fMul(w[i], pk.PolsA[i][j])) polAT[j] = fAdd(polAT[j], fMul(w[i], pk.PolsA[i][j]))
fmt.Println(polAT[j])
} }
for j := range pk.PolsB[i] { for j := range pk.PolsB[i] {
polBT[j] = fAdd(polBT[j], fMul(w[i], pk.PolsB[i][j])) polBT[j] = fAdd(polBT[j], fMul(w[i], pk.PolsB[i][j]))

Loading…
Cancel
Save