arnaucube
arnaucube/gnark-plonky2-verifierPublic Self-hosted repository
output proof (#24)

Kevin Jue kjue235@gmail.com
Mon, 19 Jun 2023 08:27:19 -0700
commit

71cfa20fcb8dfef52c894bcf1965a1fcf53726ae

parent

9ce7bb7dbb6f8d7278ad24a997600981d885fb75

1 files changed, 33 insertions(+), 4 deletions(-)

jump to
M benchmark.go → benchmark.go

@@ -1,8 +1,10 @@

package main import ( + "bytes" "flag" "fmt" + "math/big" "os" "time"

@@ -127,10 +129,37 @@ fmt.Println(err)

os.Exit(1) } - if serialize { - fProof, _ := os.Create("proof.proof") - proof.WriteTo(fProof) - } + const fpSize = 4 * 8 + var buf bytes.Buffer + 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 }