Documentation
¶
Index ¶
- Constants
- func LogExecutionTime(start time.Time, opDesc string)
- func RandInt(exclMax *big.Int) *big.Int
- func RandIntInRange(min, exclMax *big.Int) *big.Int
- func RandomBits(bitlen uint, exact bool) []byte
- func SetupLogger(logfile string)
- type DdLogProof
- type DoubleDiscreteLogProofSystem
- type GStarModPrime
- func (g *GStarModPrime) Cofactor() *big.Int
- func (g *GStarModPrime) Contains(v *big.Int) bool
- func (g *GStarModPrime) DefaultGenerator() *big.Int
- func (g *GStarModPrime) Exp(base, exp *big.Int) *big.Int
- func (g *GStarModPrime) IdentityElement() *big.Int
- func (g *GStarModPrime) Invert(i *big.Int) *big.Int
- func (g GStarModPrime) MarshalAmino() (string, error)
- func (g GStarModPrime) MarshalJSON() ([]byte, error)
- func (g *GStarModPrime) Mul(x, y *big.Int) *big.Int
- func (g *GStarModPrime) RandomElement() *big.Int
- func (g *GStarModPrime) RandomGenerator() *big.Int
- func (g *GStarModPrime) String() string
- func (g *GStarModPrime) UnmarshalAmino(bytes []byte) error
- func (g *GStarModPrime) UnmarshalJSON(bytes []byte) error
- func (g *GStarModPrime) ZModOrder() ZModPrime
- func (g *GStarModPrime) ZStarModModulus() ZStarModPrime
- func (g *GStarModPrime) ZStarModOrder() ZStarModPrime
- type Int
- func (i Int) BigInt() *big.Int
- func (i Int) IsNegative() bool
- func (i Int) IsZero() bool
- func (i Int) MarshalAmino() (string, error)
- func (i Int) MarshalJSON() ([]byte, error)
- func (i Int) String() string
- func (i *Int) UnmarshalAmino(text string) error
- func (i *Int) UnmarshalJSON(bytes []byte) error
- type PedersenCommitmentScheme
- func (s *PedersenCommitmentScheme) Commit(r *big.Int, msgs ...*big.Int) *big.Int
- func (s PedersenCommitmentScheme) MarshalAmino() (string, error)
- func (s PedersenCommitmentScheme) MarshalJSON() ([]byte, error)
- func (s *PedersenCommitmentScheme) String() string
- func (s *PedersenCommitmentScheme) UnmarshalAmino(bytes []byte) error
- func (s *PedersenCommitmentScheme) UnmarshalJSON(bytes []byte) error
- type PolyEvalProof
- type Polynomial
- func (p Polynomial) Add(other Polynomial) Polynomial
- func (p Polynomial) Degree() int
- func (p Polynomial) IncludeCredential(u *big.Int) Polynomial
- func (p Polynomial) MarshalAmino() (string, error)
- func (p Polynomial) MarshalJSON() ([]byte, error)
- func (p Polynomial) Mul(other Polynomial) Polynomial
- func (p Polynomial) MulScalar(scalar *big.Int) Polynomial
- func (p Polynomial) String() string
- func (p Polynomial) Trim() Polynomial
- func (p *Polynomial) UnmarshalAmino(bytes []byte) error
- func (p *Polynomial) UnmarshalJSON(bytes []byte) error
- type PolynomialEvaluationProofSystem
- type PreimageEqualityProof
- func (p PreimageEqualityProof) MarshalAmino() (string, error)
- func (p PreimageEqualityProof) MarshalJSON() ([]byte, error)
- func (p PreimageEqualityProof) String() string
- func (p *PreimageEqualityProof) UnmarshalAmino(bytes []byte) error
- func (p *PreimageEqualityProof) UnmarshalJSON(bytes []byte) error
- type PreimageEqualityProofSystem
- type Voter
- type ZModPrime
- func (g ZModPrime) Add(x, y *big.Int) *big.Int
- func (g ZModPrime) AdditiveIdentity() *big.Int
- func (g ZModPrime) AdditiveInvert(i *big.Int) *big.Int
- func (g ZModPrime) Contains(n *big.Int) bool
- func (g ZModPrime) Exp(base, exp *big.Int) *big.Int
- func (g ZModPrime) MarshalAmino() (string, error)
- func (g ZModPrime) MarshalJSON() ([]byte, error)
- func (g ZModPrime) Mul(x, y *big.Int) *big.Int
- func (g ZModPrime) MultiplicativeIdentity() *big.Int
- func (g ZModPrime) Order() *big.Int
- func (g ZModPrime) RandomElement() *big.Int
- func (g *ZModPrime) UnmarshalAmino(bytes []byte) error
- func (g *ZModPrime) UnmarshalJSON(bytes []byte) error
- type ZStarModPrime
- func (g ZStarModPrime) Exp(base, exp *big.Int) *big.Int
- func (g ZStarModPrime) IdentityElement() *big.Int
- func (g ZStarModPrime) MarshalAmino() (string, error)
- func (g ZStarModPrime) MarshalJSON() ([]byte, error)
- func (g ZStarModPrime) Mul(x, y *big.Int) *big.Int
- func (g ZStarModPrime) Order() *big.Int
- func (g ZStarModPrime) RandomElement() *big.Int
- func (g *ZStarModPrime) UnmarshalAmino(bytes []byte) error
- func (g *ZStarModPrime) UnmarshalJSON(bytes []byte) error
Constants ¶
const ( // Security parameter used in the double discrete log proof system. SecurityParam = 80 // Group orders and modulus for the two required groups G_p and G_q of the UEP protocol. // 160 bit, order q of G_q Q string = "1081119563825030427708677600856959359670713108783" // P = a * Q + 1, 1024 bit, order p of G_p and modulus of G_q P string = "" /* 309-byte string literal not displayed */ // O = 981 * P + 1, 1034 bit, modulus of G_p O string = "" /* 312-byte string literal not displayed */ // 1023 bit, order q of G_q Q1 string = "" /* 308-byte string literal not displayed */ // P1 = 2 * Q1 + 1, 1024 bit, order p of G_p and modulus of G_q P1 string = "" /* 309-byte string literal not displayed */ // O1 = 325 * P1 + 1, 1024 bit, modulus of G_p O1 string = "" /* 311-byte string literal not displayed */ // 2047 bit, order q of G_q Q2 string = "" /* 617-byte string literal not displayed */ // P2 = 2 * Q2 + 1, 2048 bit, order p of G_p and modulus of G_q P2 string = "" /* 617-byte string literal not displayed */ // O2 = 3157 * P2 + 1, 2048+ bit, modulus of G_p O2 string = "" /* 621-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func LogExecutionTime ¶
LogExecutionTime logs the time past since the given start time.
func RandInt ¶
RandInt chooses a uniform random big.Int less than a given number. Taken and adapted from https://github.com/dedis/kyber/blob/master/util/random/rand.go
func RandIntInRange ¶
RandInt chooses a uniform random big.Int less than a given number. Taken and adapted from https://github.com/dedis/kyber/blob/master/util/random/rand.go
func RandomBits ¶
RandomBits fetches uniform random random bits with a maximum of the given bit length. If 'exact' is true, exactly bitlen number of bits are set. The returned byte array is in big-endian order, ready for usage with big.Int. Adapted from https://github.com/dedis/kyber/blob/master/util/random/rand.go
func SetupLogger ¶
func SetupLogger(logfile string)
SetupLogger sets up the logger to log to the given file. The file is created in the current user's home directory.
Types ¶
type DdLogProof ¶
type DdLogProof struct { T *big.Int T1Arr []*big.Int // Length equal to the security parameter. T2Arr []*big.Int // Length equal to the security parameter. ZX *big.Int ZR *big.Int ZMArr [][]*big.Int // A 2D array with len(zMArr) == securityParam and len(Zm[i]) == 2. ZSArr []*big.Int // Length equal to the security parameter. ZRArr []*big.Int // Length equal to the security parameter. }
DdLogProof represents a proof transcript for a proof of known representation of a committed value.
func (DdLogProof) MarshalAmino ¶
func (p DdLogProof) MarshalAmino() (string, error)
func (DdLogProof) MarshalJSON ¶
func (p DdLogProof) MarshalJSON() ([]byte, error)
func (DdLogProof) String ¶
func (p DdLogProof) String() string
func (*DdLogProof) UnmarshalAmino ¶
func (p *DdLogProof) UnmarshalAmino(bytes []byte) error
func (*DdLogProof) UnmarshalJSON ¶
func (p *DdLogProof) UnmarshalJSON(bytes []byte) error
type DoubleDiscreteLogProofSystem ¶
type DoubleDiscreteLogProofSystem struct { CommSchemeInGp PedersenCommitmentScheme // The commitment scheme used for the committed value CommSchemeInGq PedersenCommitmentScheme // The commitment scheme used for the representation. SecurityParam int // Security parameter determining the security level of the proof system. // contains filtered or unexported fields }
DoubleDiscreteLogProofSystem is used to prove knowledge of a representation of a committed value without revealing the representation nor the committed value. The proof is made non-interactive. It is based on the paper "Proof-of-Knowledge of Representation of Committed Value and Its Applications" by Man Ho Au et al. The class name is due to it being a generalization of double discrete log proofs.
func NewDoubleDiscreteLogProofSystem ¶
func NewDoubleDiscreteLogProofSystem(commSchemeInGp PedersenCommitmentScheme, commSchemeInGq PedersenCommitmentScheme, securityParam int) DoubleDiscreteLogProofSystem
NewDoubleDiscreteLogProofSystem creates a new instance of the proof system with the given commitment schemes and security parameter.
func (*DoubleDiscreteLogProofSystem) Generate ¶
func (ps *DoubleDiscreteLogProofSystem) Generate(voter Voter, commToU *big.Int, commToURand *big.Int, commToAandB *big.Int, commToAandBRand *big.Int, vote string) DdLogProof
Generate generates a proof of known representation of committed value. The parameters include the voters public and private credentials, commitments to the these credentials, the randomness values used in the commitments and the voter's vote.
func (*DoubleDiscreteLogProofSystem) Verify ¶
func (ps *DoubleDiscreteLogProofSystem) Verify(proof DdLogProof, commToU *big.Int, commToAandB *big.Int, vote string) bool
Verify verifies a proof of known representation of committed values. Next to the proof transcript, the committed value and the commitment to the representation are the input parameters.
type GStarModPrime ¶
type GStarModPrime struct { Modulus *big.Int `json:"mod"` // The modulus of the group. A prime number. Order *big.Int `json:"ord"` // The order of the group. A prime number. }
GStarModPrime represents the concept of a prime-order subgroup of the multiplicative group of integers modulo a prime. The decisional Diffie-Hellman assumption is believed to hold in such a group.
func NewGStarModPrime ¶
func NewGStarModPrime(modulus *big.Int, order *big.Int) GStarModPrime
NewGStarModPrime creates a new instance of the group with the given order and modulus. Both arguments must be prime numbers.
func (*GStarModPrime) Cofactor ¶
func (g *GStarModPrime) Cofactor() *big.Int
Cofactor calculates and returns the cofactor of this group. The cofactor r is calculated as r = (p-1)/q. Cf. the construction of Schnorr groups.
func (*GStarModPrime) Contains ¶
func (g *GStarModPrime) Contains(v *big.Int) bool
Contains checks if the given value is an element of this group. The value v is an element of this group if 1 < v < p and v^q = 1 (mod p).
func (*GStarModPrime) DefaultGenerator ¶
func (g *GStarModPrime) DefaultGenerator() *big.Int
DefaultGenerator gets the default generator for this group. Implemented according to http://en.wikipedia.org/wiki/Schnorr_group
func (*GStarModPrime) Exp ¶
func (g *GStarModPrime) Exp(base, exp *big.Int) *big.Int
Exp computes base^exp mod this group's modulus.
func (*GStarModPrime) IdentityElement ¶
func (g *GStarModPrime) IdentityElement() *big.Int
IdentityElement returns the identity element of this group which is always 1.
func (*GStarModPrime) Invert ¶
func (g *GStarModPrime) Invert(i *big.Int) *big.Int
Invert computes and returns the multiplicative inverse of the given group element.
func (GStarModPrime) MarshalAmino ¶
func (g GStarModPrime) MarshalAmino() (string, error)
func (GStarModPrime) MarshalJSON ¶
func (g GStarModPrime) MarshalJSON() ([]byte, error)
func (*GStarModPrime) Mul ¶
func (g *GStarModPrime) Mul(x, y *big.Int) *big.Int
Mul computes x * y mod this group's modulus.
func (*GStarModPrime) RandomElement ¶
func (g *GStarModPrime) RandomElement() *big.Int
RandomElement gets a random element of this group.
func (*GStarModPrime) RandomGenerator ¶
func (g *GStarModPrime) RandomGenerator() *big.Int
RandomGenerator gets a randomly selected generator for this group. Implemented according to Appendix A.2.1 of FIPS 186-4
func (*GStarModPrime) String ¶
func (g *GStarModPrime) String() string
String returns a string representation of this group.
func (*GStarModPrime) UnmarshalAmino ¶
func (g *GStarModPrime) UnmarshalAmino(bytes []byte) error
func (*GStarModPrime) UnmarshalJSON ¶
func (g *GStarModPrime) UnmarshalJSON(bytes []byte) error
func (*GStarModPrime) ZModOrder ¶
func (g *GStarModPrime) ZModOrder() ZModPrime
ZModOrder returns the ring of integers modulo this group's order.
func (*GStarModPrime) ZStarModModulus ¶
func (g *GStarModPrime) ZStarModModulus() ZStarModPrime
ZStartModModulus returns the multiplicative group of integers modulo this group's modulus, i.e. the multiplicative group (Z*_p) of which this group (G*_q) is a subgroup.
func (*GStarModPrime) ZStarModOrder ¶
func (g *GStarModPrime) ZStarModOrder() ZStarModPrime
ZStarModOrder returns multiplicative group of integers modulo this group's order.
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int wraps a Go big integer and is necessary for marshalling/unmarshalling big integers in Tendermint. We explicitly don't use github.com/cosmos/cosmos-sdk/types.Int because it is restricted to 256-bit integers. The UEP voting protocol requires bigger integers for sufficient security.
func IntFromString ¶
IntFromString tries to parses the given string as a big integer and returns a new instance of Int.
func (Int) IsNegative ¶
IsNegative returns true if this integer has a negative sign.
func (Int) MarshalAmino ¶
MarshalAmino byte-serializes this big integer and returns the bytes as a string.
func (Int) MarshalJSON ¶
MarshalJSON serializes this big integer to JSON format
func (*Int) UnmarshalAmino ¶
UnmarshalAmino deserializes the given string of bytes into this big integer.
func (*Int) UnmarshalJSON ¶
UnmarshalJSON deserializes the given JSON bytes into this big integer.
type PedersenCommitmentScheme ¶
type PedersenCommitmentScheme struct { G GStarModPrime // cyclic, multiplicative group cyclic group of the generators Hr *big.Int // randomization generator, h_0 Hm []*big.Int // message generators, h_1 to h_n }
PedersenCommitmentScheme is used to commit to a message m given a random value r in the following way: Com(m, r) = h1^m * h2^r. Where h1 and h2 are generators of a cyclic group. The scheme can be used in a generalized manner, i.e. one can commit to multiple messages in one commitment. Thus, a instance of the scheme can have multiple message generators.
func NewPedersenCommitmentScheme ¶
func NewPedersenCommitmentScheme(g GStarModPrime, hr *big.Int, hm []*big.Int) PedersenCommitmentScheme
NewPedersenCommitmentScheme creates a new instance of the scheme. The instance is based on the given group and generators which must be generators of the group.
func (*PedersenCommitmentScheme) Commit ¶
Commit creates a commitment to the given messages msgs with the given randomness r.
func (PedersenCommitmentScheme) MarshalAmino ¶
func (s PedersenCommitmentScheme) MarshalAmino() (string, error)
func (PedersenCommitmentScheme) MarshalJSON ¶
func (s PedersenCommitmentScheme) MarshalJSON() ([]byte, error)
MarshalJSON serializes this big integer to JSON format
func (*PedersenCommitmentScheme) String ¶
func (s *PedersenCommitmentScheme) String() string
String returns a string representation of this scheme.
func (*PedersenCommitmentScheme) UnmarshalAmino ¶
func (s *PedersenCommitmentScheme) UnmarshalAmino(bytes []byte) error
func (*PedersenCommitmentScheme) UnmarshalJSON ¶
func (s *PedersenCommitmentScheme) UnmarshalJSON(bytes []byte) error
type PolyEvalProof ¶
type PolyEvalProof struct { CArr []*big.Int // Length d. Doesn't include the commitment to credential u. CfArr []*big.Int // Length d + 1 CdArr []*big.Int // Length d + 1 CfuArr []*big.Int // Length d FBarArr []*big.Int // Length d + 1 RBarArr []*big.Int // Length d + 1 TBar *big.Int XiBarArr []*big.Int // d }
PolyEvalProof represents a transcript of a polynomial evaluation proof.
func (PolyEvalProof) MarshalAmino ¶
func (p PolyEvalProof) MarshalAmino() (string, error)
func (PolyEvalProof) MarshalJSON ¶
func (p PolyEvalProof) MarshalJSON() ([]byte, error)
func (PolyEvalProof) String ¶
func (p PolyEvalProof) String() string
func (*PolyEvalProof) UnmarshalAmino ¶
func (p *PolyEvalProof) UnmarshalAmino(bytes []byte) error
func (*PolyEvalProof) UnmarshalJSON ¶
func (p *PolyEvalProof) UnmarshalJSON(bytes []byte) error
type Polynomial ¶
type Polynomial struct { Coeffs []*big.Int // Coefficients ordered ascending by degree (i.e idx 0 is the constant term) ZModPr ZModPrime // The polynomial's ring. }
Polynomial represents a polynomial in the polynomial ring Z_p[x], where Z_p is the ring of integers mod prime p. The coefficients are elements of Z_p and coefficient arithmetic is performed/modulo p.
A polynomial holds a slice of big integer pointers (the coefficients) and an instance of ZModPrime instance, therefor copying a polynomial is not expensive.
Adapted from https://github.com/mbottini/newton/blob/master/polynomial/polynomial.go.
func NewPolynomial ¶
func NewPolynomial(coeffs []*big.Int, zModPr ZModPrime) Polynomial
NewPolynomial creates a new Polynomial instance with the given coefficients and the ring. Note that no deep copy of the coefficients is performed. If you don't want modificaitons of the poynomial to show in the original argument, make sure to create copies of the integers first.
func (Polynomial) Add ¶
func (p Polynomial) Add(other Polynomial) Polynomial
Add adds the given polynomial to this one and returns the result. Both inputs are not modified and the new polynomial's coefficients are new Int instances, i.e. changes in the input polynomials do not affect the new polynomial and vice versa.
func (Polynomial) Degree ¶
func (p Polynomial) Degree() int
Degree gets the degree of this polynomial, i.e. the largest integer m for which coefficient a_m != 0
func (Polynomial) IncludeCredential ¶
func (p Polynomial) IncludeCredential(u *big.Int) Polynomial
IncludeCredential includes the given credential u into this polynomial and returns the resulting polynomial. The credential is included by multiplying the polynomial with (X - u). The input polynomial is not modified and the new polynomial's coefficients are new Int instances, i.e. changes in the input polynomial do not affect the new polynomial and vice versa.
func (Polynomial) MarshalAmino ¶
func (p Polynomial) MarshalAmino() (string, error)
func (Polynomial) MarshalJSON ¶
func (p Polynomial) MarshalJSON() ([]byte, error)
func (Polynomial) Mul ¶
func (p Polynomial) Mul(other Polynomial) Polynomial
Mul multiplies two Polynomials together and returns the resulting Polynomial. The input polynomials are not modified and the new polynomial's coefficients are new Int instances, i.e. changes in the input polynomials do not affect the new polynomial and vice versa.
func (Polynomial) MulScalar ¶
func (p Polynomial) MulScalar(scalar *big.Int) Polynomial
MulScalar multiplies each coefficient in this polynomial by scalar and returns the resulting polynomial. The input polynomial is not modified and the new polynomial's coefficients are new Int instances, i.e. changes in the input polynomial do not affect the new polynomial and vice versa.
func (Polynomial) String ¶
func (p Polynomial) String() string
String returns a string representation of this polynomial.
func (Polynomial) Trim ¶
func (p Polynomial) Trim() Polynomial
Trim removes trailing zero terms from the Polynomial and returns a new trimmed Polynomial. For example, 0x^3 + 0x^2 + 3x + 1 results in 3x + 1. The remaining coefficients are not copied, i.e. changes in the original polynomial will affect the trimmed polynomial and vice versa.
func (*Polynomial) UnmarshalAmino ¶
func (p *Polynomial) UnmarshalAmino(bytes []byte) error
func (*Polynomial) UnmarshalJSON ¶
func (p *Polynomial) UnmarshalJSON(bytes []byte) error
type PolynomialEvaluationProofSystem ¶
type PolynomialEvaluationProofSystem struct { CommScheme PedersenCommitmentScheme // The scheme used to commit to the public credential u. Polynomial Polynomial // The credential polynomial containing all eligible voters. // contains filtered or unexported fields }
PolynomialEvaluationProofSystem is the proof system used for set membership proofs. It is used to prove that a voter's public credential is in the set of eligible voters. It is based on the work "A practical system for globally revoking the unlinkable pseudonyms of unknown users" by Stefan Brands et al.
func NewPolynomialEvaluationProofSystem ¶
func NewPolynomialEvaluationProofSystem(commScheme PedersenCommitmentScheme, poly Polynomial) PolynomialEvaluationProofSystem
NewPolynomialEvaluationProofSystem creates a new instance of the proof system. The given commitment scheme is the one used to commit to the voter's public credential u. The polynomial is the credential polynomial containing all eligible voter's public credentials.
func (*PolynomialEvaluationProofSystem) Generate ¶
func (ps *PolynomialEvaluationProofSystem) Generate(u, r, commToU *big.Int, vote string) PolyEvalProof
Generate generates a polynomial evaluation proof for the given voter public credential u. Provide a commitment commToU to the voter's public credential u with a random commitment element r.
func (*PolynomialEvaluationProofSystem) Verify ¶
func (ps *PolynomialEvaluationProofSystem) Verify(proof PolyEvalProof, commToU *big.Int, vote string) bool
Verify verifies the given proof transcript.
type PreimageEqualityProof ¶
type PreimageEqualityProof struct { Comm *big.Int CommHHat *big.Int RespA *big.Int RespB *big.Int RespS *big.Int }
PreimageEqualityProof represents a transcript of a preimage equality proof.
func (PreimageEqualityProof) MarshalAmino ¶
func (p PreimageEqualityProof) MarshalAmino() (string, error)
func (PreimageEqualityProof) MarshalJSON ¶
func (p PreimageEqualityProof) MarshalJSON() ([]byte, error)
func (PreimageEqualityProof) String ¶
func (p PreimageEqualityProof) String() string
func (*PreimageEqualityProof) UnmarshalAmino ¶
func (p *PreimageEqualityProof) UnmarshalAmino(bytes []byte) error
func (*PreimageEqualityProof) UnmarshalJSON ¶
func (p *PreimageEqualityProof) UnmarshalJSON(bytes []byte) error
type PreimageEqualityProofSystem ¶
type PreimageEqualityProofSystem struct { HHat *big.Int // Election generator used to generate the voter's election credential // Commitment scheme used to commit to the voter's private credentials alpha and beta. CommScheme PedersenCommitmentScheme // contains filtered or unexported fields }
PreimageEqualityProofSystem is used to proof equality of preimages. In the case of the UEP voting protocol it is used to proof that a voter's private credential beta was used in generating commitment d and election credential uHat.
func NewPreimageEqualityProofSystem ¶
func NewPreimageEqualityProofSystem(hHat *big.Int, commScheme PedersenCommitmentScheme) PreimageEqualityProofSystem
NewPreimageEqualityProofSystem sets up a new instance of the proof system. Parameter hHat is the election generator used to generate the voter's election credential uHat. The parameter commScheme is the commitment scheme used to commit to the voter's private credentials alpha and beta.
func (*PreimageEqualityProofSystem) Generate ¶
func (ps *PreimageEqualityProofSystem) Generate(voter Voter, commToAandB *big.Int, commToAandBRand *big.Int, uHat *big.Int, vote string) PreimageEqualityProof
Generate generates a preimage equality proof for the given commitment to alpha and beta (commToAandB) and the election credential uHat.
func (*PreimageEqualityProofSystem) Verify ¶
func (ps *PreimageEqualityProofSystem) Verify(proof PreimageEqualityProof, commToAandB *big.Int, uHat *big.Int, vote string) bool
Verify verifies the given preimage equality proof transcript.
type Voter ¶
type Voter struct { A *big.Int // private credential alpha, random element in Z_q B *big.Int // private credential beta, random element in Z_q U *big.Int // public credential u = h1^a h2^b mod q, h1 and h2 generators of G_q }
Voter encapsulates the credentials of a voter. I.e. the private credentials alpha and beta and the public credential u. The election credential u_hat is excluded.
func GenerateNewVoter ¶
func GenerateNewVoter(commQ PedersenCommitmentScheme) Voter
GenerateNewVoter generates new private and public credentials and returns a Voter instance with those credentials.
type ZModPrime ¶
ZModPrime represents the ring of integers modulo a prime p (abbreviated as Z_p). Addition, subtraction and multiplication are performed modulo p.
func NewZModPrime ¶
NewZModPrime constructs a new instance of a ring using p as its modulus.
func (ZModPrime) AdditiveIdentity ¶
AdditiveIdentity returns the additive identity element of this ring, which is always 0.
func (ZModPrime) AdditiveInvert ¶
AdditiveInvert computes the additive inverse of the given element.
func (ZModPrime) MarshalAmino ¶
func (ZModPrime) MarshalJSON ¶
func (ZModPrime) MultiplicativeIdentity ¶
MultiplicativeIdentity returns the multiplicative identity element of this ring, which is always 1.
func (ZModPrime) RandomElement ¶
RandomElement gets a random element of this ring.
func (*ZModPrime) UnmarshalAmino ¶
func (*ZModPrime) UnmarshalJSON ¶
type ZStarModPrime ¶
ZStarModPrime represents the multiplicative group of integers modulo prime p, abbreviated as Z*_p. The group's order is equal to p-1 because p is prime.
func NewZStarModPrime ¶
func NewZStarModPrime(p *big.Int) ZStarModPrime
NewZStarModPrime creates a new instance of this group with the given modulus p which must be a prime number.
func (ZStarModPrime) Exp ¶
func (g ZStarModPrime) Exp(base, exp *big.Int) *big.Int
Exp computes base^exp mod this group's modulus.
func (ZStarModPrime) IdentityElement ¶
func (g ZStarModPrime) IdentityElement() *big.Int
IdentityElement returns the identity element of this group which is always 1.
func (ZStarModPrime) MarshalAmino ¶
func (g ZStarModPrime) MarshalAmino() (string, error)
func (ZStarModPrime) MarshalJSON ¶
func (g ZStarModPrime) MarshalJSON() ([]byte, error)
func (ZStarModPrime) Mul ¶
func (g ZStarModPrime) Mul(x, y *big.Int) *big.Int
Mul computes x * y mod this group's modulus.
func (ZStarModPrime) Order ¶
func (g ZStarModPrime) Order() *big.Int
Order gets the order of this group, i.e. p - 1 because p is prime.
func (ZStarModPrime) RandomElement ¶
func (g ZStarModPrime) RandomElement() *big.Int
RandomElement gets a random element of this group.
func (*ZStarModPrime) UnmarshalAmino ¶
func (g *ZStarModPrime) UnmarshalAmino(bytes []byte) error
func (*ZStarModPrime) UnmarshalJSON ¶
func (g *ZStarModPrime) UnmarshalJSON(bytes []byte) error