share

package
v0.0.0-...-579f5cf Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT, MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package share implements Shamir secret sharing and polynomial commitments. Shamir's scheme allows you to split a secret value into multiple parts, so called shares, by evaluating a secret sharing polynomial at certain indices. The shared secret can only be reconstructed (via Lagrange interpolation) if a threshold of the participants provide their shares. A polynomial commitment scheme allows a committer to commit to a secret sharing polynomial so that a verifier can check the claimed evaluations of the committed polynomial. Both schemes of this package are core building blocks for more advanced secret sharing techniques.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoverCommit

func RecoverCommit(g group.Group, shares []*PubShare, t, n int) (group.Point, error)

RecoverCommit reconstructs the secret commitment p(0) from a list of public shares using Lagrange interpolation.

Types

type PriPoly

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

PriPoly represents a secret sharing polynomial.

func NewPriPoly

func NewPriPoly(grp group.Group, t int, s group.Scalar, rand cipher.Stream) *PriPoly

NewPriPoly creates a new secret sharing polynomial using the provided cryptographic group, the secret sharing threshold t, and the secret to be shared s. If s is nil, a new s is chosen using the provided randomness stream rand.

func (*PriPoly) Eval

func (p *PriPoly) Eval(i int) *PriShare

Eval computes the private share v = p(i).

func (*PriPoly) Secret

func (p *PriPoly) Secret() group.Scalar

Secret returns the shared secret p(0), i.e., the constant term of the polynomial.

func (*PriPoly) Shares

func (p *PriPoly) Shares(n int) []*PriShare

Shares creates a list of n private shares p(1),...,p(n).

func (*PriPoly) String

func (p *PriPoly) String() string

type PriShare

type PriShare struct {
	I int          // Index of the private share
	V group.Scalar // Value of the private share
}

PriShare represents a private share.

func (*PriShare) String

func (p *PriShare) String() string

type PubShare

type PubShare struct {
	I int         // Index of the public share
	V group.Point // Value of the public share
}

PubShare represents a public share.

Jump to

Keyboard shortcuts

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