Implementing a non-interactive zero-knowledge proof in Rust
Suppose Alice has to prove knowledge of
Assuming
And
Remark: The values of
- For
$p = 131$ , although$b = 17$ and$b = 2$ are valid primitive elements, it is best to choose$b = 2$ .
Alice can produce a proof
- uses a PRF to sample a random integer
$v$ , - then calculates
$b^v =: s$ - uses the system’s CRH to compute
$c := CRH(b, x, s)$ - finally computes
$r := v - (k*c)$
and publishes
Any party can verify Alice's proof as follows,
- uses the CRH to compute
$CRH(b, x, s) =: c$ - checks if
$b^r * x^c = s$ in order to verify that Alice knows$k$ .
- 1st, note
$b^r * x^c = b^{v - (k * c)} * (b^k)^c = b^v * b^{-(k*c)} * b^{k * c} = b^v = s$ . - 2nd, the outcome
$c$ of the hash function CRH was unpredictable. - 3rd, it is infeasible to solve the Discrete Log Problem for a large integer
$b$ . Therefore Alice must have known$k$ , because there's no other way she could have correctly computed$r$ .