preimage

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvePartialPreimageKnowledge

func ProvePartialPreimageKnowledge(homomorphism func(*big.Int) *big.Int, H crypto.Group,
	v1, u1, u2 *big.Int, iterations int) bool

ProvePartialPreimageKnowledge demonstrates how prover can prove that he knows f^(-1)(u1) and the verifier does not know whether knowledge of f^(-1)(u1) or f^(-1)(u2) was proved. Note that PartialDLogKnowledge is a special case of PartialPreimageKnowledge.

func ProvePreimageKnowledge

func ProvePreimageKnowledge(homomorphism func(*big.Int) *big.Int, H crypto.Group,
	u, v *big.Int, iterations int) bool

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.

Types

type PartialProver

type PartialProver struct {
	Homomorphism func(*big.Int) *big.Int
	H            crypto.Group
	// contains filtered or unexported fields
}

func NewPartialProver

func NewPartialProver(homomorphism func(*big.Int) *big.Int, H crypto.Group,
	v1, u1, u2 *big.Int) *PartialProver

func (*PartialProver) GetProofData

func (p *PartialProver) GetProofData(challenge *big.Int) (*big.Int, *big.Int,
	*big.Int, *big.Int)

func (*PartialProver) GetProofRandomData

func (p *PartialProver) GetProofRandomData() (*common.Pair, *common.Pair)

GetProofRandomData returns Homomorphism(r1) and Homomorphism(z2)/(u2^c2) in random order and where r1, z2, c2 are random from H.

type PartialVerifier

type PartialVerifier struct {
	Homomorphism func(*big.Int) *big.Int
	H            crypto.Group
	// contains filtered or unexported fields
}

func NewPartialVerifier

func NewPartialVerifier(homomorphism func(*big.Int) *big.Int,
	H crypto.Group) *PartialVerifier

func (*PartialVerifier) GetChallenge

func (v *PartialVerifier) GetChallenge() *big.Int

func (*PartialVerifier) SetProofRandomData

func (v *PartialVerifier) SetProofRandomData(pair1, pair2 *common.Pair)

func (*PartialVerifier) Verify

func (v *PartialVerifier) Verify(c1, z1, c2, z2 *big.Int) bool

type Prover

type Prover struct {
	Homomorphism func(*big.Int) *big.Int
	H            crypto.Group
	// contains filtered or unexported fields
}

Prover proves that it knows v such that f(v) = u, given homomorphism f: H -> G and u from group G. This is a generalized Schnorr prover, but one-bit challenges need to be used to enable extractor (more to be added in docs).

func NewProver

func NewProver(homomorphism func(*big.Int) *big.Int, H crypto.Group,
	v *big.Int) *Prover

func (*Prover) GetProofData

func (p *Prover) GetProofData(challenge *big.Int) *big.Int

GetProofData receives challenge defined by a verifier, and returns z = r * v^challenge.

func (*Prover) GetProofRandomData

func (p *Prover) GetProofRandomData() *big.Int

Chooses random r from H and returns QOneWayHomomorpism(r).

type Verifier

type Verifier struct {
	Homomorphism func(*big.Int) *big.Int
	H            crypto.Group
	// contains filtered or unexported fields
}

func NewVerifier

func NewVerifier(homomorphism func(*big.Int) *big.Int, H crypto.Group,
	u *big.Int) *Verifier

func (*Verifier) GetChallenge

func (v *Verifier) GetChallenge() *big.Int

func (*Verifier) SetProofRandomData

func (v *Verifier) SetProofRandomData(x *big.Int)

func (*Verifier) Verify

func (v *Verifier) Verify(z *big.Int) bool

It receives z = r * v^challenge. It returns true if Homomorphism(z) = x * u^challenge, otherwise false.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL