Documentation ¶
Index ¶
- func ProveEquality(secret, g1, g2, t1, t2 *big.Int, group *Group) bool
- func ProvePartialDLogKnowledge(group *Group, secret1, a1, a2, b2 *big.Int) bool
- type BTEqualityProver
- type BTEqualityVerifier
- type BlindedTrans
- type EqualityProver
- type EqualityVerifier
- type Group
- type PartialProver
- type PartialVerifier
- type Proof
- type Prover
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProveEquality ¶
ProveEquality demonstrates how prover can prove the knowledge of log_g1(t1), log_g2(t2) and that log_g1(t1) = log_g2(t2).
func ProvePartialDLogKnowledge ¶
ProvePartialDLogKnowledge demonstrates how prover can prove that he knows dlog_a2(b2) and the verifier does not know whether knowledge of dlog_a1(b1) or knowledge of dlog_a2(b2) was proved.
Types ¶
type BTEqualityProver ¶
type BTEqualityProver struct { Group *Group // contains filtered or unexported fields }
func NewBTEqualityProver ¶
func NewBTEqualityProver(group *Group) *BTEqualityProver
func (*BTEqualityProver) GetProofData ¶
func (p *BTEqualityProver) GetProofData(challenge *big.Int) *big.Int
func (*BTEqualityProver) GetProofRandomData ¶
Prove that you know dlog_g1(h1), dlog_g2(h2) and that dlog_g1(h1) = dlog_g2(h2).
type BTEqualityVerifier ¶
type BTEqualityVerifier struct { Group *Group // contains filtered or unexported fields }
func NewBTEqualityVerifier ¶
func NewBTEqualityVerifier(group *Group, gamma *big.Int) *BTEqualityVerifier
func (*BTEqualityVerifier) GetChallenge ¶
func (v *BTEqualityVerifier) GetChallenge(g1, g2, t1, t2, x1, x2 *big.Int) *big.Int
type BlindedTrans ¶
BlindedTrans represents a blinded transcript.
func NewBlindedTrans ¶
func NewBlindedTrans(a, b, hash, zAlpha *big.Int) *BlindedTrans
func (*BlindedTrans) Verify ¶
func (t *BlindedTrans) Verify(group *Group, g1, t1, G2, T2 *big.Int) bool
Verifies that the blinded transcript is valid. That means the knowledge of log_g1(t1), log_G2(T2) and log_g1(t1) = log_G2(T2). Note that G2 = g2^gamma, T2 = t2^gamma where gamma was chosen by verifier.
type EqualityProver ¶
type EqualityProver struct { Group *Group // contains filtered or unexported fields }
func NewEqualityProver ¶
func NewEqualityProver(group *Group) *EqualityProver
func (*EqualityProver) GetProofData ¶
func (p *EqualityProver) GetProofData(challenge *big.Int) *big.Int
func (*EqualityProver) GetProofRandomData ¶
type EqualityVerifier ¶
type EqualityVerifier struct { Group *Group // contains filtered or unexported fields }
func NewEqualityVerifier ¶
func NewEqualityVerifier(group *Group) *EqualityVerifier
func (*EqualityVerifier) GetChallenge ¶
func (v *EqualityVerifier) GetChallenge(g1, g2, t1, t2, x1, x2 *big.Int) *big.Int
type Group ¶
type Group struct { P *big.Int // modulus of the group G *big.Int // generator of subgroup Q *big.Int // order of G }
Group is a cyclic group in modular arithmetic. It holds P = Q * R + 1 for some R. The actual value R is never used (although a random element from this group could be computed by a^R for some random a from Z_p* - this element would have order Q and would be thus from this group), the important thing is that Q divides P-1.
func NewGroup ¶
NewGroup generates random Group with generator G and parameters P and Q where P = R * Q + 1 for some R. Order of G is Q.
func NewGroupFromParams ¶
func (*Group) GetRandomElement ¶
GetRandomElement returns a random element from this group. Note that elements from this group are integers smaller than group.P, but not all - only Q of them. GetRandomElement returns one (random) of these Q elements.
func (*Group) Inv ¶
Inv computes inverse of x in Group. This means xInv such that x * xInv = 1 mod group.P.
func (*Group) IsElementInGroup ¶
IsElementInGroup returns true if x is in the group and false otherwise. Note that an element x is in Schnorr group when x^group.Q = 1 mod group.P.
type PartialProver ¶
type PartialProver struct { Group *Group // contains filtered or unexported fields }
Proving that it knows either secret1 such that a1^secret1 = b1 (mod p1) or
secret2 such that a2^secret2 = b2 (mod p2).
func NewPartialProver ¶
func NewPartialProver(group *Group) *PartialProver
func (*PartialProver) GetProofData ¶
func (*PartialProver) GetProofRandomData ¶
type PartialVerifier ¶
type PartialVerifier struct { Group *Group // contains filtered or unexported fields }
func NewPartialVerifier ¶
func NewPartialVerifier(group *Group) *PartialVerifier
func (*PartialVerifier) GetChallenge ¶
func (v *PartialVerifier) GetChallenge() *big.Int
func (*PartialVerifier) SetProofRandomData ¶
func (v *PartialVerifier) SetProofRandomData(triple1, triple2 *common.Triple)
type Proof ¶
Proof presents all three messages in sigma protocol - useful when challenge is generated by prover via Fiat-Shamir.
type Prover ¶
type Prover struct { Group *Group // contains filtered or unexported fields }
Prover is a generalized Schnorr - while usually Schnorr proof is executed with one base, Prover for a given y enables proof of knowledge of secrets x_1,...,x_k such that y = g_1^x_1 * ... * g_k^x_k where g_i are given generators (bases) of Schnorr group. For a "normal" Schnorr just use bases and secrets arrays with only one element.
func (*Prover) GetProofRandomData ¶
type Verifier ¶
type Verifier struct { Group *Group // contains filtered or unexported fields }
func NewVerifier ¶
func (*Verifier) GetChallenge ¶
func (*Verifier) SetChallenge ¶
SetChallenge is used when Fiat-Shamir is used - when challenge is generated using hash by the prover.
func (*Verifier) SetProofRandomData ¶
TODO: SetProofRandomData name is not ok - it is not only setting proofRandomData, but also bases and y. It might be split (a, b for example set in Verifier constructor).