sharsec

package module
v0.0.0-...-6255ad7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 6 Imported by: 0

README

Sharsec

This repository will host a couple toy implementation of interesting secret-sharing algorithms.

You will find Shamir's secret-sharing protocol in shamir.go.

An implementation of Schoenmakers' PVSS can be found in pvss.go

All implementations should implement the sharsec.SSS interface

Please do not use this in production. This is only a personal academic exercise.

Build:

go mod tidy

go build

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClearShare

type ClearShare struct {
	SID   *finitefield.FpInt
	Value curvewrapper.Point
}

type EncryptedShare

type EncryptedShare = ClearShare

func (EncryptedShare) Decrypt

func (e EncryptedShare) Decrypt(priv []byte) ClearShare

type Key

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

type Polynomial

type Polynomial interface {
	Eval(*big.Int, *big.Int) *big.Int
	String() string
}

type SSS

type SSS interface {
	Split([]byte, int, []Key) []Share
	Combine([]Share) []byte
}

type Shamir

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

func NewShamirSystem

func NewShamirSystem(curve elliptic.Curve) *Shamir

func (*Shamir) Combine

func (s *Shamir) Combine(c []ClearShare) []byte

func (*Shamir) GeneratePolynomial

func (s *Shamir) GeneratePolynomial(deg int) ShamirPoly

func (*Shamir) NewKey

func (s *Shamir) NewKey() Key

func (*Shamir) Split

func (s *Shamir) Split(secret []byte, threshold int, pubkeys []Key) []ClearShare

type ShamirPoly

type ShamirPoly []*big.Int

func (ShamirPoly) Eval

func (p ShamirPoly) Eval(x *big.Int, mod *big.Int) *big.Int

func (ShamirPoly) String

func (p ShamirPoly) String()

type Share

type Share interface {
	Encrypt(Key) Share
	Decrypt(Key) Share
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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