mirror of
https://github.com/arnaucube/gnark-plonky2-verifier.git
synced 2026-01-12 17:11:31 +01:00
output proof (#24)
This commit is contained in:
37
benchmark.go
37
benchmark.go
@@ -1,8 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -127,10 +129,37 @@ func createProof(plonky2Circuit string, r1cs constraint.ConstraintSystem, pk gro
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if serialize {
|
const fpSize = 4 * 8
|
||||||
fProof, _ := os.Create("proof.proof")
|
var buf bytes.Buffer
|
||||||
proof.WriteTo(fProof)
|
proof.WriteRawTo(&buf)
|
||||||
}
|
proofBytes := buf.Bytes()
|
||||||
|
|
||||||
|
var (
|
||||||
|
a [2]*big.Int
|
||||||
|
b [2][2]*big.Int
|
||||||
|
c [2]*big.Int
|
||||||
|
)
|
||||||
|
|
||||||
|
// proof.Ar, proof.Bs, proof.Krs
|
||||||
|
a[0] = new(big.Int).SetBytes(proofBytes[fpSize*0 : fpSize*1])
|
||||||
|
a[1] = new(big.Int).SetBytes(proofBytes[fpSize*1 : fpSize*2])
|
||||||
|
b[0][0] = new(big.Int).SetBytes(proofBytes[fpSize*2 : fpSize*3])
|
||||||
|
b[0][1] = new(big.Int).SetBytes(proofBytes[fpSize*3 : fpSize*4])
|
||||||
|
b[1][0] = new(big.Int).SetBytes(proofBytes[fpSize*4 : fpSize*5])
|
||||||
|
b[1][1] = new(big.Int).SetBytes(proofBytes[fpSize*5 : fpSize*6])
|
||||||
|
c[0] = new(big.Int).SetBytes(proofBytes[fpSize*6 : fpSize*7])
|
||||||
|
c[1] = new(big.Int).SetBytes(proofBytes[fpSize*7 : fpSize*8])
|
||||||
|
|
||||||
|
println("a[0] is ", a[0].String())
|
||||||
|
println("a[1] is ", a[1].String())
|
||||||
|
|
||||||
|
println("b[0][0] is ", b[0][0].String())
|
||||||
|
println("b[0][1] is ", b[0][1].String())
|
||||||
|
println("b[1][0] is ", b[1][0].String())
|
||||||
|
println("b[1][1] is ", b[1][1].String())
|
||||||
|
|
||||||
|
println("c[0] is ", c[0].String())
|
||||||
|
println("c[1] is ", c[1].String())
|
||||||
|
|
||||||
return proof
|
return proof
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user