pedersen

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeCommitments

func EncodeCommitments(w io.Writer, comms []Commitment) error

Types

type Commitment

type Commitment struct {
	// Value is the point which has been commited to
	Value ristretto.Point
	// blinding factor is the blinding scalar.
	// Note that n vectors have 1 blinding factor
	BlindingFactor ristretto.Scalar
}

Commitment represents a Pedersen Commitment storing the value and the random blinding factor

func DecodeCommitments

func DecodeCommitments(r io.Reader) ([]Commitment, error)

func (*Commitment) Decode

func (c *Commitment) Decode(r io.Reader) error

func (*Commitment) Encode

func (c *Commitment) Encode(w io.Writer) error

func (*Commitment) EqualValue

func (c *Commitment) EqualValue(other Commitment) bool

func (*Commitment) Equals

func (c *Commitment) Equals(other Commitment) bool

type Pedersen

type Pedersen struct {
	BaseVector *generator.Generator
	GenData    []byte
	BlindPoint ristretto.Point
	BasePoint  ristretto.Point
}

Pedersen represents a pedersen struct which holds the necessary information to commit a vector or a scalar to a point

func New

func New(genData []byte) *Pedersen

New will setup the BaseVector returning a Pedersen struct genData is the byte slice, that will be used to form the unique set of generators

func (*Pedersen) CommitToScalar

func (p *Pedersen) CommitToScalar(v ristretto.Scalar) Commitment

CommitToScalar generates a Commitment to a scalar v, s.t. V = v * Base + blind * BlindingPoint

func (*Pedersen) CommitToVectors

func (p *Pedersen) CommitToVectors(vectors ...[]ristretto.Scalar) Commitment

CommitToVectors will take n set of vectors and form a commitment to them s.t. V = aH + <v1, G1> + <v2, G2> + <v3, G3> where a is a scalar, v1 is a vector of scalars, and G1 is a vector of points

Jump to

Keyboard shortcuts

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