// ProvePreimageKnowledge demonstrates how given homomorphism f:H->G and element u from G
// prover can prove the knowledge of v such that f(v) = u.
ProvePreimageKnowledge demonstrates how given homomorphism f:H->G and element u from G
prover can prove the knowledge of v such that f(v) = u.
// ProvePreimageKnowledge demonstrates how given homomorphism f : H - > G and element u from G // prover can prove the knowledge of v such that f ( v ) = u .
func ProveHomomorphismPreimageKnowledge(homomorphism func(*big.Int) *big.Int, H groups.Group,
	u, v *big.Int, iterations int) bool {
	prover := NewHomomorphismPreimageProver(homomorphism, H, v)
	verifier := NewHomomorphismPreimageVerifier(homomorphism, H, u)
	for j := 0; j < iterations; j++ {
		proofRandomData := prover.GetProofRandomData()
		verifier.SetProofRandomData(proofRandomData)
		challenge := verifier.GetChallenge()
		z := prover.GetProofData(challenge)
		if !verifier.Verify(z) {
			return false
		}
	}
	return true
}
func ProveHomomorphismPreimageKnowledge ( homomorphism func ( * big . Int ) * big . Int , H groups . Group , u , v * big . Int , iterations int ) bool { prover := NewHomomorphismPreimageProver ( homomorphism , H , v ) verifier := NewHomomorphismPreimageVerifier ( homomorphism , H , u ) for j := 0 ; j < iterations ; j ++ { proofRandomData := prover . GetProofRandomData ( ) verifier . SetProofRandomData ( proofRandomData ) challenge := verifier . GetChallenge ( ) z := prover . GetProofData ( challenge ) if ! verifier . Verify ( z ) { return false } } return true }
ProvePreimageKnowledge demonstrates how given homomorphism f:H->G and element u from G
prover can prove the knowledge of v such that f(v) = u.
ProvePreimageKnowledge demonstrates how given homomorphism f : H - > G and element u from G prover can prove the knowledge of v such that f ( v ) = u .
// The proof needs to be repeated sequentially because one-bit challenges are used. Note // that when one-bit challenges are used, the prover has in one iteration 50% chances // that guesses the challenge. Thus, sufficient number of iterations is needed (like 80). // One-bit challenges are required - otherwise proof of knowledge extractor might // not work (algorithm to extract preimage when prover is used as a black-box and // rewinded to use the same first message in both executions).