zkrangeproof

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Add

func Add(x *big.Int, y *big.Int) *big.Int

func CalculateHash

func CalculateHash(b1 *big.Int, b2 *big.Int) (*big.Int, error)

func CftValidateZeroKnowledgeProof added in v0.6.12

func CftValidateZeroKnowledgeProof(
	b *big.Int,
	N *big.Int,
	g *big.Int,
	h *big.Int,
	E *big.Int,
	cftProof []*big.Int) bool

func Commit

func Commit(x, r *big.Int, h *bn256.G2) (*bn256.G2, error)

Commit method corresponds to the Pedersen commitment scheme. Namely, given input message x, and randomness r, it outputs g^x.h^r.

func CommitG1

func CommitG1(x, r *big.Int, h *bn256.G1) (*bn256.G1, error)

CommitG1 method corresponds to the Pedersen commitment scheme. Namely, given input message x, and randomness r, it outputs g^x.h^r.

func Decompose

func Decompose(x *big.Int, u int64, l int64) ([]int64, error)

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 DivMod added in v0.6.12

func DivMod(x *big.Int, y *big.Int, modulo *big.Int) *big.Int

func GetBigInt

func GetBigInt(value string) *big.Int

Read big integer in base 10 from string.

func HPAKEEqualityConstraintValidateZeroKnowledgeProof

func HPAKEEqualityConstraintValidateZeroKnowledgeProof(
	N *big.Int,
	g1 *big.Int,
	g2 *big.Int,
	h1 *big.Int,
	h2 *big.Int,
	E *big.Int,
	F *big.Int,
	ecProof []*big.Int) bool

func HPAKESquareValidateZeroKnowledgeProof

func HPAKESquareValidateZeroKnowledgeProof(
	N *big.Int,
	g *big.Int,
	h *big.Int,
	E *big.Int,
	sqProof []*big.Int) bool

func Hash

func Hash(a []*bn256.GT, D *bn256.G2) (*big.Int, error)

Hash is responsible for the computing a Zp element given elements from GT and G2.

func HashSet

func HashSet(a *bn256.GT, D *bn256.G2) (*big.Int, error)

HashSet is responsible for the computing a Zp element given elements from GT and G2.

func Mod

func Mod(base *big.Int, modulo *big.Int) *big.Int

func ModInverse

func ModInverse(base *big.Int, modulo *big.Int) *big.Int

func ModPow

func ModPow(base *big.Int, exponent *big.Int, modulo *big.Int) *big.Int

*

  • Returns base**exponent mod |modulo| also works for negative exponent (contrary to big.Int.Exp)

func Multiply

func Multiply(factor1 *big.Int, factor2 *big.Int) *big.Int

func Pow added in v0.6.12

func Pow(base *big.Int, exponent *big.Int) *big.Int

func ProveSet

func ProveSet(x int64, r *big.Int, p paramsSet) (proofSet, error)

ProveSet method is used to produce the ZK Set Membership proof.

func ProveUL

func ProveUL(x, r *big.Int, p paramsUL) (proofUL, error)

ProveUL method is used to produce the ZKRP proof that secret x belongs to the interval [0,U^L].

func SetupSet

func SetupSet(s []int64) (paramsSet, error)

SetupSet generates the signature for the elements in the set.

func SetupUL

func SetupUL(u, l int64) (paramsUL, error)

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 Sub

func Sub(x *big.Int, y *big.Int) *big.Int

func ValidateRangeProof

func ValidateRangeProof(lowerLimit *big.Int,
	upperLimit *big.Int,
	commitment []*big.Int,
	proof []*big.Int) bool

func VerifySet

func VerifySet(proof_out *proofSet, p *paramsSet) (bool, error)

VerifySet is used to validate the ZK Set Membership proof. It returns true iff the proof is valid.

func VerifyUL

func VerifyUL(proof_out *proofUL, p *paramsUL) (bool, error)

VerifyUL is used to validate the ZKRP proof. It returns true iff the proof is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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