proof

package
v0.0.0-...-e663500 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package proof range proof via sum of three squares (3SPR) Paper: Removing the Strong RSA Assumption from Arguments over the Integers Link: https://eprint.iacr.org/2016/128

Package proof range proof via sum of three squares (3SPR) Paper: Removing the Strong RSA Assumption from Arguments over the Integers Link: https://eprint.iacr.org/2016/128

Package proof zkPoKE Protocol zkPoKE for R_{PoKE} Paper: Batching Techniques for Accumulators with Applications to IOPs and Stateless Blockchains Link: https://eprint.iacr.org/2018/1188.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(target *big.Int, ti Int3) bool

Verify checks if the three-square sum is equal to the original integer i.e. target = t1^2 + t2^2 + t3^2

Types

type ArgOfPositivity

type ArgOfPositivity struct {
	// contains filtered or unexported fields
}

ArgOfPositivity is the argument of positivity of an integer

func NewArgOfPositivity

func NewArgOfPositivity(commit3 Int3, commitment zkAoPCommitment, response *zkAoPResponse) *ArgOfPositivity

NewArgOfPositivity generates a new argument of positivity

type Int3

type Int3 [int3Len]*big.Int

Int3 is the 3-number big integer group

func NewInt3

func NewInt3(w1 *big.Int, w2 *big.Int, w3 *big.Int) Int3

NewInt3 creates a new 3-number group, in descending order

func ThreeSquares

func ThreeSquares(n *big.Int) (Int3, error)

ThreeSquares calculates the three square sum of a given integer i.e. target = t1^2 + t2^2 + t3^2 Please note that we only consider the situation of target = 4N + 1, as in our range proof implementation, every integer passed to this function is in the form of 4N + 1.

type Int4

type Int4 [int4Len]*big.Int

Int4 is the 4-number big integer group

func NewInt4

func NewInt4(w1 *big.Int, w2 *big.Int, w3 *big.Int, w4 *big.Int) Int4

NewInt4 creates a new 4-number group, in descending order

func (*Int4) Div

func (f *Int4) Div(n *big.Int)

Div divides all the 4 numbers by n

func (*Int4) Mul

func (f *Int4) Mul(n *big.Int)

Mul multiplies all the 4 numbers by n

func (*Int4) String

func (f *Int4) String() string

String stringnifies the Int4 object

type PublicParameters

type PublicParameters struct {
	N *big.Int
	G *big.Int
	H *big.Int
}

PublicParameters holds public parameters initialized during the setup procedure

func NewPublicParameters

func NewPublicParameters(n, g, h *big.Int) *PublicParameters

NewPublicParameters generates a new public parameter configuration

type RPProver

type RPProver struct {
	// contains filtered or unexported fields
}

RPProver refers to the Prover in zero-knowledge integer range proof

func NewRPProver

func NewRPProver(pp *PublicParameters, r, a, b *big.Int) *RPProver

NewRPProver generates a new range proof prover

func (*RPProver) Prove

func (r *RPProver) Prove(x *big.Int) (*RangeProof, error)

Prove generates the proof for range proof

type RPVerifier

type RPVerifier struct {
	// contains filtered or unexported fields
}

RPVerifier refers to the Verifier in zero-knowledge integer range proof

func NewRPVerifier

func NewRPVerifier(pp *PublicParameters, a, b *big.Int) *RPVerifier

NewRPVerifier generates a new range proof verifier

func (*RPVerifier) Verify

func (r *RPVerifier) Verify(proof *RangeProof) bool

Verify verifies the range proof

func (*RPVerifier) VerifyResponse

func (r *RPVerifier) VerifyResponse(response *rpResponse) bool

VerifyResponse verifies the response, if accepts, return true; otherwise, return false

type RangeProof

type RangeProof struct {
	// contains filtered or unexported fields
}

RangeProof is the proof for range proof

func NewRangeProof

func NewRangeProof(c *big.Int, commit3 Int3, commitment rpCommitment, response *rpResponse) *RangeProof

NewRangeProof generates a new proof for range proof

type ZKAoPProver

type ZKAoPProver struct {
	C *big.Int // c = (g^x)(h^r)
	// contains filtered or unexported fields
}

ZKAoPProver refers to the Prover in zero-knowledge integer argument of positivity

func NewZKAoPProver

func NewZKAoPProver(pp *PublicParameters, r *big.Int) *ZKAoPProver

NewZKAoPProver generates a new argument-of-positivity prover

func (*ZKAoPProver) Prove

func (r *ZKAoPProver) Prove(x *big.Int) (*ArgOfPositivity, error)

Prove generates the proof for range proof

type ZKAoPVerifier

type ZKAoPVerifier struct {
	// contains filtered or unexported fields
}

ZKAoPVerifier refers to the Verifier in zero-knowledge integer argument of positivity

func NewZKAoPVerifier

func NewZKAoPVerifier(pp *PublicParameters, c *big.Int) *ZKAoPVerifier

NewZKAoPVerifier generates a new integer argument of positivity verifier

func (*ZKAoPVerifier) Verify

func (r *ZKAoPVerifier) Verify(proof *ArgOfPositivity) bool

Verify verifies the argument of positivity

func (*ZKAoPVerifier) VerifyResponse

func (r *ZKAoPVerifier) VerifyResponse(response *zkAoPResponse) bool

VerifyResponse verifies the response, if accepts, return true; otherwise, return false

type ZKPoKEProof

type ZKPoKEProof struct {
	// contains filtered or unexported fields
}

ZKPoKEProof represents the proof of knowledge of exponentiation

type ZKPoKEProver

type ZKPoKEProver struct {
	// contains filtered or unexported fields
}

ZKPoKEProver is the prover for proof of exponentiation

func NewZKPoKEProver

func NewZKPoKEProver(pp *PublicParameters) *ZKPoKEProver

NewZKPoKEProver creates a new prover of proof of exponentiation

func (*ZKPoKEProver) Prove

func (zp *ZKPoKEProver) Prove(u, x *big.Int) (*ZKPoKEProof, error)

Prove generates the proof for proof of exponentiation

type ZKPoKEVerifier

type ZKPoKEVerifier struct {
	// contains filtered or unexported fields
}

ZKPoKEVerifier is the verifier for proof of exponentiation

func NewZKPoKEVerifier

func NewZKPoKEVerifier(pp *PublicParameters) *ZKPoKEVerifier

NewZKPoKEVerifier creates a new verifier of proof of exponentiation

func (*ZKPoKEVerifier) Verify

func (zv *ZKPoKEVerifier) Verify(proof *ZKPoKEProof, u, w *big.Int) (bool, error)

Verify checks the proof of exponentiation

func (*ZKPoKEVerifier) VerifyResponse

func (zv *ZKPoKEVerifier) VerifyResponse(c, l, u, w *big.Int, response *zkPoKEResponse, commit *zkPoKECommitment) (bool, error)

VerifyResponse verifies the response of the verifier

Jump to

Keyboard shortcuts

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