Csaba Kiraly ed0145921c
por: print keys for test vector generation
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-06-12 03:47:10 +02:00

41 lines
1.2 KiB
Nim

## Nim-POS
## Copyright (c) 2021 Status Research & Development GmbH
## Licensed under either of
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
## at your option.
## This file may not be copied, modified, or distributed except according to
## those terms.
import por
import benchmark
import strutils
const sectorsperblock = 1.int64
const querylen = 1
proc testbls() : bool =
benchmark "Key generation":
let (spk, ssk) = por.keygen()
echo "Public key: ", $ spk
echo "Private key: ", $ ssk
benchmark "Auth generation (s=" & $sectorsperblock & ")":
let (tau, authenticators) = por.setup(ssk, sectorsperblock, "example.txt")
echo "tau: ", tau
echo "Auth: ", authenticators
benchmark "Generating challenge (q=" & $querylen & ")":
let q = por.generateQuery(tau, spk, querylen)
echo "Generated!", "\nq:", q
benchmark "Issuing proof":
let (mu, sigma) = por.generateProof(q, authenticators, spk, sectorsperblock, "example.txt")
echo "Issued!", "\nmu:", mu, "\nsigma:", sigma
benchmark "Verifying proof":
result = por.verifyProof(tau, q, mu, sigma, spk)
echo "Result: ", result
let r = testbls()