zksch

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commitment

type Commitment struct {
	C curve.Point
}

Commitment = randomness•G, where

func EmptyCommitment

func EmptyCommitment(group curve.Curve) *Commitment

func (Commitment) Domain

func (Commitment) Domain() string

Domain implements hash.WriterToWithDomain

func (*Commitment) IsValid

func (c *Commitment) IsValid() bool

func (*Commitment) WriteTo

func (c *Commitment) WriteTo(w io.Writer) (int64, error)

WriteTo implements io.WriterTo.

type Proof

type Proof struct {
	C Commitment
	Z Response
}

func EmptyProof

func EmptyProof(group curve.Curve) *Proof

func NewProof

func NewProof(hash *hash.Hash, public curve.Point, private curve.Scalar, gen curve.Point) *Proof

NewProof generates a Schnorr proof of knowledge of exponent for public, using the Fiat-Shamir transform.

func (*Proof) IsValid

func (p *Proof) IsValid() bool

func (*Proof) Verify

func (p *Proof) Verify(hash *hash.Hash, public, gen curve.Point) bool

Verify checks that Proof.Response•G = Proof.Commitment + H(..., Proof.Commitment, Public)•Public.

type Randomness

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

Randomness = a ← ℤₚ.

func NewRandomness

func NewRandomness(rand io.Reader, group curve.Curve, gen curve.Point) *Randomness

NewRandomness creates a new a ∈ ℤₚ and the corresponding commitment C = a•G. This can be used to run the proof in a non-interactive way.

func (*Randomness) Commitment

func (r *Randomness) Commitment() *Commitment

Commitment returns the commitment C = a•G for the randomness a.

func (*Randomness) Prove

func (r *Randomness) Prove(hash *hash.Hash, public curve.Point, secret curve.Scalar, gen curve.Point) *Response

Prove creates a Response = Randomness + H(..., Commitment, public)•secret (mod p).

type Response

type Response struct {
	Z curve.Scalar
	// contains filtered or unexported fields
}

Response = randomness + H(..., commitment, public)•secret (mod p).

func EmptyResponse

func EmptyResponse(group curve.Curve) *Response

func (*Response) IsValid

func (z *Response) IsValid() bool

func (*Response) Verify

func (z *Response) Verify(hash *hash.Hash, public curve.Point, commitment *Commitment, gen curve.Point) bool

Verify checks that Response•G = Commitment + H(..., Commitment, public)•Public.

Jump to

Keyboard shortcuts

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