Documentation ¶
Index ¶
- Variables
- func Add(x *big.Int, y *big.Int) *big.Int
- func CalculateHash(b1 *big.Int, b2 *big.Int) (*big.Int, error)
- func Commit(x, r *big.Int, h *bn256.G2) (*bn256.G2, error)
- func CommitG1(x, r *big.Int, h *bn256.G1) (*bn256.G1, error)
- func Decompose(x *big.Int, u int64, l int64) ([]int64, error)
- func GetBigInt(value string) *big.Int
- func HPAKEEqualityConstraintValidateZeroKnowledgeProof(N *big.Int, g1 *big.Int, g2 *big.Int, h1 *big.Int, h2 *big.Int, E *big.Int, ...) bool
- func HPAKESquareValidateZeroKnowledgeProof(N *big.Int, g *big.Int, h *big.Int, E *big.Int, sqProof []*big.Int) bool
- func Hash(a []*bn256.GT, D *bn256.G2) (*big.Int, error)
- func HashSet(a *bn256.GT, D *bn256.G2) (*big.Int, error)
- func Mod(base *big.Int, modulo *big.Int) *big.Int
- func ModInverse(base *big.Int, modulo *big.Int) *big.Int
- func ModPow(base *big.Int, exponent *big.Int, modulo *big.Int) *big.Int
- func Multiply(factor1 *big.Int, factor2 *big.Int) *big.Int
- func ProveSet(x int64, r *big.Int, p paramsSet) (proofSet, error)
- func ProveUL(x, r *big.Int, p paramsUL) (proofUL, error)
- func SetupSet(s []int64) (paramsSet, error)
- func SetupUL(u, l int64) (paramsUL, error)
- func Sub(x *big.Int, y *big.Int) *big.Int
- func ValidateRangeProof(lowerLimit *big.Int, upperLimit *big.Int, commitment []*big.Int, ...) bool
- func VerifySet(proof_out *proofSet, p *paramsSet) (bool, error)
- func VerifyUL(proof_out *proofUL, p *paramsUL) (bool, error)
Constants ¶
This section is empty.
Variables ¶
var ( G1 = new(bn256.G1).ScalarBaseMult(new(big.Int).SetInt64(1)) G2 = new(bn256.G2).ScalarBaseMult(new(big.Int).SetInt64(1)) E = bn256.Pair(G1, G2) )
Constants that are going to be used frequently, then we just need to compute them once.
Functions ¶
func Commit ¶
Commit method corresponds to the Pedersen commitment scheme. Namely, given input message x, and randomness r, it outputs g^x.h^r.
func CommitG1 ¶
CommitG1 method corresponds to the Pedersen commitment scheme. Namely, given input message x, and randomness r, it outputs g^x.h^r.
func Decompose ¶
Decompose receives as input a bigint x and outputs an array of integers such that x = sum(xi.u^i), i.e. it returns the decomposition of x into base u.
func ModPow ¶
*
- Returns base**exponent mod |modulo| also works for negative exponent (contrary to big.Int.Exp)
func ProveUL ¶
ProveUL method is used to produce the ZKRP proof that secret x belongs to the interval [0,U^L].
func SetupUL ¶
SetupUL generates the signature for the interval [0,u^l). The value of u should be roughly b/log(b), but we can choose smaller values in order to get smaller parameters, at the cost of having worse performance.
func ValidateRangeProof ¶
Types ¶
This section is empty.