sharing

package
v0.0.0-...-35ce414 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package sharing is an implementation of shamir secret sharing and implements the following papers.

- https://dl.acm.org/doi/pdf/10.1145/359168.359176 - https://www.cs.umd.edu/~gasarch/TOPICS/secretsharing/feldmanVSS.pdf - https://link.springer.com/content/pdf/10.1007%2F3-540-46766-1_9.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feldman

type Feldman struct {
	Threshold, Limit uint32
	Curve            *curves.Curve
}

func NewFeldman

func NewFeldman(threshold, limit uint32, curve *curves.Curve) (*Feldman, error)

func (Feldman) Combine

func (f Feldman) Combine(shares ...*ShamirShare) (curves.Scalar, error)

func (Feldman) CombinePoints

func (f Feldman) CombinePoints(shares ...*ShamirShare) (curves.Point, error)

func (Feldman) LagrangeCoeffs

func (f Feldman) LagrangeCoeffs(shares map[uint32]*ShamirShare) (map[uint32]curves.Scalar, error)

func (Feldman) Split

func (f Feldman) Split(secret curves.Scalar, reader io.Reader) (*FeldmanVerifier, []*ShamirShare, error)

type FeldmanVerifier

type FeldmanVerifier struct {
	Commitments []curves.Point
}

func (FeldmanVerifier) Verify

func (v FeldmanVerifier) Verify(share *ShamirShare) error

type Pedersen

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

Pedersen Verifiable Secret Sharing Scheme

func NewPedersen

func NewPedersen(threshold, limit uint32, generator curves.Point) (*Pedersen, error)

NewPedersen creates a new pedersen VSS

func (Pedersen) Combine

func (pd Pedersen) Combine(shares ...*ShamirShare) (curves.Scalar, error)

func (Pedersen) CombinePoints

func (pd Pedersen) CombinePoints(shares ...*ShamirShare) (curves.Point, error)

func (Pedersen) LagrangeCoeffs

func (pd Pedersen) LagrangeCoeffs(shares map[uint32]*ShamirShare) (map[uint32]curves.Scalar, error)

func (Pedersen) Split

func (pd Pedersen) Split(secret curves.Scalar, reader io.Reader) (*PedersenResult, error)

Split creates the verifiers, blinding and shares

type PedersenResult

type PedersenResult struct {
	Blinding                     curves.Scalar
	BlindingShares, SecretShares []*ShamirShare
	FeldmanVerifier              *FeldmanVerifier
	PedersenVerifier             *PedersenVerifier
}

PedersenResult contains all the data from calling Split

type PedersenVerifier

type PedersenVerifier struct {
	Generator   curves.Point
	Commitments []curves.Point
}

func (PedersenVerifier) Verify

func (pv PedersenVerifier) Verify(share, blindShare *ShamirShare) error

type Polynomial

type Polynomial struct {
	Coefficients []curves.Scalar
}

func (Polynomial) Evaluate

func (p Polynomial) Evaluate(x curves.Scalar) curves.Scalar

func (*Polynomial) Init

func (p *Polynomial) Init(intercept curves.Scalar, degree uint32, reader io.Reader) *Polynomial

type Shamir

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

func NewShamir

func NewShamir(threshold, limit uint32, curve *curves.Curve) (*Shamir, error)

func (Shamir) Combine

func (s Shamir) Combine(shares ...*ShamirShare) (curves.Scalar, error)

func (Shamir) CombinePoints

func (s Shamir) CombinePoints(shares ...*ShamirShare) (curves.Point, error)

func (Shamir) LagrangeCoeffs

func (s Shamir) LagrangeCoeffs(identities []uint32) (map[uint32]curves.Scalar, error)

func (Shamir) Split

func (s Shamir) Split(secret curves.Scalar, reader io.Reader) ([]*ShamirShare, error)

type ShamirShare

type ShamirShare struct {
	Id    uint32 `json:"identifier"`
	Value []byte `json:"value"`
}

func (ShamirShare) Bytes

func (ss ShamirShare) Bytes() []byte

func (ShamirShare) Validate

func (ss ShamirShare) Validate(curve *curves.Curve) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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