schnorr

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: Apache-2.0 Imports: 6 Imported by: 9

Documentation

Overview

Package schnorr implements a Schnorr proof, as described and used in Doerner, et al. https://eprint.iacr.org/2018/499.pdf see Functionalities 6. it also implements a "committed" version, as described in Functionality 7.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecommitVerify

func DecommitVerify(proof *Proof, commitment Commitment, curve *curves.Curve, basepoint curves.Point, uniqueSessionId []byte) error

DecommitVerify receives a `Proof` and a `Commitment`; it first checks that the proof actually opens the commitment; then it verifies the proof. returns and error if either on eof thse fail.

func Verify

func Verify(proof *Proof, curve *curves.Curve, basepoint curves.Point, uniqueSessionId []byte) error

Verify verifies the `proof`, given the prover parameters `scalar` and `curve`. As for the prover, we allow `basePoint == nil`, in this case, it's auto-assigned to be the group's default generator.

Types

type Commitment

type Commitment = []byte

type Proof

type Proof struct {
	C         curves.Scalar
	S         curves.Scalar
	Statement curves.Point
}

Proof contains the (c, s) schnorr proof. `Statement` is the curve point you're proving knowledge of discrete log of, with respect to the base point.

type Prover

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

func NewProver

func NewProver(curve *curves.Curve, basepoint curves.Point, uniqueSessionId []byte) *Prover

NewProver generates a `Prover` object, ready to generate Schnorr proofs on any given point. We allow the option `basePoint == nil`, in which case `basePoint` is auto-assigned to be the "default" generator for the group.

func (*Prover) Prove

func (p *Prover) Prove(x curves.Scalar) (*Proof, error)

Prove generates and returns a Schnorr proof, given the scalar witness `x`. in the process, it will actually also construct the statement (just one curve mult in this case)

func (*Prover) ProveCommit

func (p *Prover) ProveCommit(x curves.Scalar) (*Proof, Commitment, error)

ProveCommit generates _and_ commits to a schnorr proof which is later revealed; see Functionality 7. returns the Proof and Commitment.

Jump to

Keyboard shortcuts

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