pedersen

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Overview

Package pedersen implements the Pedersen vector commitment scheme verifier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commitment

type Commitment[G1El algebra.G1ElementT] struct {
	G1El G1El
}

Commitment is a Pedersen commitment to a vector.

func ValueOfCommitment

func ValueOfCommitment[G1El algebra.G1ElementT](cmt any) (Commitment[G1El], error)

ValueOfCommitment returns a Commitment from a native Pedersen commitment. It returns an error if the input does not match the expected type.

type KnowledgeProof

type KnowledgeProof[G1El algebra.G1ElementT] struct {
	G1El G1El
}

KnowledgeProof is a knowledge proof for a Pedersen commitment.

func ValueOfKnowledgeProof

func ValueOfKnowledgeProof[G1El algebra.G1ElementT](kp any) (KnowledgeProof[G1El], error)

ValueOfKnowledgeProof returns a KnowledgeProof from a native Pedersen knowledge proof. It returns an error if the input does not match the expected type.

type Verifier

type Verifier[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT] struct {
	// contains filtered or unexported fields
}

Verifier verifies the knowledge proofs for a Pedersen commitments

func NewVerifier

func NewVerifier[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT](api frontend.API) (*Verifier[FR, G1El, G2El, GtEl], error)

NewVerifier returns a new verifier for Pedersen commitments.

func (*Verifier[FR, G1El, G2El, GtEl]) AssertCommitment

func (v *Verifier[FR, G1El, G2El, GtEl]) AssertCommitment(commitment Commitment[G1El], knowledgeProof KnowledgeProof[G1El], vk VerifyingKey[G2El], opts ...VerifierOption) error

AssertCommitment verifies the given commitment and knowledge proof against the given verifying key.

func (*Verifier[FR, G1El, G2El, GtEl]) FoldCommitments

func (v *Verifier[FR, G1El, G2El, GtEl]) FoldCommitments(commitments []Commitment[G1El], auxTranscript ...*emulated.Element[FR]) (Commitment[G1El], error)

FoldCommitments folds the given commitments into a single commitment for efficient verification.

Currently the function panics as folding is not implemented yet.

type VerifierOption

type VerifierOption func(cfg *verifierCfg) error

VerifierOption allows to modify the behaviour of Pedersen verifier.

func WithSubgroupCheck

func WithSubgroupCheck() VerifierOption

WithSubgroupCheck returns a VerifierOption that forces subgroup check.

type VerifyingKey

type VerifyingKey[G2El algebra.G2ElementT] struct {
	G             G2El
	GRootSigmaNeg G2El // (-1/σ)[G] for toxic σ
}

VerifyingKey is a verifying key for Pedersen vector commitments.

func ValueOfVerifyingKey

func ValueOfVerifyingKey[G2El algebra.G2ElementT](vk any) (VerifyingKey[G2El], error)

ValueOfVerifyingKey returns a VerifyingKey from a native Pedersen verifying key. It returns an error if the input does not match the expected type. The method does not precompute the Miller loop lines for pairing computation, and allows to use different keys in-circuit.

func ValueOfVerifyingKeyFixed

func ValueOfVerifyingKeyFixed[G2El algebra.G2ElementT](vk any) (VerifyingKey[G2El], error)

ValueOfVerifyingKeyFixed returns a VerifyingKey from a native Pedersen verifying key. It returns an error if the input does not match the expected type. The method precomputes the Miller loop lines for pairing computation, requiring to embed the key in-circuit at compile time.

Jump to

Keyboard shortcuts

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