ecpedersen

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Committer

type Committer struct {
	Params     *Params
	Commitment *ec.GroupElement
	// contains filtered or unexported fields
}

Committer can commit to some value x - it sends to receiver c = g^x * h^r. When decommitting, committer sends to receiver r, x; receiver checks whether c = g^x * h^r.

func NewCommitter

func NewCommitter(params *Params) *Committer

func (*Committer) GetCommitMsg

func (c *Committer) GetCommitMsg(val *big.Int) (*ec.GroupElement, error)

It receives a value x (to this value a commitment is made), chooses a random x, outputs c = g^x * g^r.

func (*Committer) GetDecommitMsg

func (c *Committer) GetDecommitMsg() (*big.Int, *big.Int)

It returns values x and r (commitment was c = g^x * g^r).

func (*Committer) VerifyTrapdoor

func (c *Committer) VerifyTrapdoor(trapdoor *big.Int) bool

type Params

type Params struct {
	Group *ec.Group
	H     *ec.GroupElement
	// contains filtered or unexported fields
}

func GenerateParams

func GenerateParams(curveType ec.Curve) *Params

func NewParams

func NewParams(group *ec.Group, H *ec.GroupElement, a *big.Int) *Params

type Receiver

type Receiver struct {
	Params *Params
	// contains filtered or unexported fields
}

func NewReceiver

func NewReceiver(curve ec.Curve) *Receiver

func NewReceiverFromParams

func NewReceiverFromParams(params *Params) *Receiver

func (*Receiver) CheckDecommitment

func (r *Receiver) CheckDecommitment(R, val *big.Int) bool

When receiver receives a decommitment, CheckDecommitment verifies it against the stored value (stored by SetCommitment).

func (*Receiver) GetTrapdoor

func (r *Receiver) GetTrapdoor() *big.Int

func (*Receiver) SetCommitment

func (r *Receiver) SetCommitment(el *ec.GroupElement)

When receiver receives a commitment, it stores the value using SetCommitment method.

Jump to

Keyboard shortcuts

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