zk

package
v0.0.0-...-5abc84a Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 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 Schnorr

type Schnorr struct {
	// S = H( ID || CTX || public || M )
	// R = k + secret • s
	S, R ristretto.Scalar
}

Schnorr is a Non-Interactive Zero-Knowledge proof of knowledge of the discrete logarithm of public = [secret] B

The public parameters are:

partyID: prover's uint32 ID
context: 32 byte context string,
public:  [secret] B

func NewSchnorrProof

func NewSchnorrProof(partyID party.ID, public *ristretto.Element, context []byte, private *ristretto.Scalar) *Schnorr

NewSchnorrProof computes a NIZK proof of knowledge of discrete.

partyID is the uint32 ID of the prover
public is the point [private]•B
context is a 32 byte context (if it is set to [0 ... 0] then we may be susceptible to replay attacks)
private is the discrete log of public

We sample a random Scalar k, and obtain M = [k]•B S := H(ID,CTX,Public,M) R := k + private•S

The proof returned is the tuple (S,R)

func (*Schnorr) BytesAppend

func (proof *Schnorr) BytesAppend(existing []byte) (data []byte, err error)

func (*Schnorr) Equal

func (proof *Schnorr) Equal(other interface{}) bool

func (*Schnorr) MarshalBinary

func (proof *Schnorr) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*Schnorr) Size

func (proof *Schnorr) Size() int

func (*Schnorr) UnmarshalBinary

func (proof *Schnorr) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (*Schnorr) Verify

func (proof *Schnorr) Verify(partyID party.ID, public *ristretto.Element, context []byte) bool

Verify verifies that the zero knowledge proof is valid.

partyID is the uint32 ID of the prover
public is the point [private]•B
context is a 32 byte context (if it is set to [0 ... 0] then we may be susceptible to replay attacks)

Jump to

Keyboard shortcuts

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