v1

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func K256GeneratorFromHashedBytes

func K256GeneratorFromHashedBytes(bytes []byte) (x, y *big.Int, err error)

K256GeneratorFromHashedBytes computes a generator whose discrete log is unknown from a bytes sequence

Types

type Bls12381G1Curve

type Bls12381G1Curve struct {
	*elliptic.CurveParams
}

func Bls12381G1

func Bls12381G1() *Bls12381G1Curve

func Bls12381G2

func Bls12381G2() *Bls12381G1Curve

func (*Bls12381G1Curve) Add

func (curve *Bls12381G1Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)

func (*Bls12381G1Curve) CompressedBytesFromBigInts

func (curve *Bls12381G1Curve) CompressedBytesFromBigInts(x, y *big.Int) ([]byte, error)

CompressedBytesFromBigInts takes x and y coordinates and converts them to the BLS compressed point form

func (*Bls12381G1Curve) Double

func (curve *Bls12381G1Curve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)

func (*Bls12381G1Curve) Hash

func (curve *Bls12381G1Curve) Hash(msg []byte) (*big.Int, *big.Int)

Hash an arbitrary byte sequence to a G1 point according to the hash-to-curve standard

func (*Bls12381G1Curve) IsOnCurve

func (curve *Bls12381G1Curve) IsOnCurve(x, y *big.Int) bool

func (*Bls12381G1Curve) Params

func (curve *Bls12381G1Curve) Params() *elliptic.CurveParams

func (*Bls12381G1Curve) ScalarBaseMult

func (curve *Bls12381G1Curve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)

func (*Bls12381G1Curve) ScalarMult

func (curve *Bls12381G1Curve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)

type Bls12381G2Curve

type Bls12381G2Curve struct {
	*elliptic.CurveParams
}

func (*Bls12381G2Curve) Add

func (curve *Bls12381G2Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)

func (*Bls12381G2Curve) CompressedBytesFromBigInts

func (curve *Bls12381G2Curve) CompressedBytesFromBigInts(x, y *big.Int) ([]byte, error)

CompressedBytesFromBigInts takes x and y coordinates and converts them to the BLS compressed point form

func (*Bls12381G2Curve) Double

func (curve *Bls12381G2Curve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)

func (*Bls12381G2Curve) Hash

func (curve *Bls12381G2Curve) Hash(msg []byte) (*big.Int, *big.Int)

Hash an arbitrary byte sequence to a G1 point according to the hash-to-curve standard

func (*Bls12381G2Curve) IsOnCurve

func (curve *Bls12381G2Curve) IsOnCurve(x, y *big.Int) bool

func (*Bls12381G2Curve) Params

func (curve *Bls12381G2Curve) Params() *elliptic.CurveParams

func (*Bls12381G2Curve) ScalarBaseMult

func (curve *Bls12381G2Curve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)

func (*Bls12381G2Curve) ScalarMult

func (curve *Bls12381G2Curve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)

type Ed25519Curve

type Ed25519Curve struct {
	*elliptic.CurveParams
}

func Ed25519

func Ed25519() *Ed25519Curve

func (*Ed25519Curve) Add

func (curve *Ed25519Curve) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int)

func (*Ed25519Curve) Double

func (curve *Ed25519Curve) Double(x1, y1 *big.Int) (*big.Int, *big.Int)

func (*Ed25519Curve) Hash

func (curve *Ed25519Curve) Hash(msg []byte) (*big.Int, *big.Int)

func (*Ed25519Curve) IsOnCurve

func (curve *Ed25519Curve) IsOnCurve(x, y *big.Int) bool

func (*Ed25519Curve) Neg

func (curve *Ed25519Curve) Neg(Bx, By *big.Int) (*big.Int, *big.Int)

func (*Ed25519Curve) Params

func (curve *Ed25519Curve) Params() *elliptic.CurveParams

func (*Ed25519Curve) ScalarBaseMult

func (curve *Ed25519Curve) ScalarBaseMult(k []byte) (*big.Int, *big.Int)

func (*Ed25519Curve) ScalarMult

func (curve *Ed25519Curve) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int)

type Feldman

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

Feldman Verifiable Secret Sharing Scheme

func NewFeldman

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

func (Feldman) Combine

func (f Feldman) Combine(shares ...*ShamirShare) ([]byte, error)

func (Feldman) Split

func (f Feldman) Split(secret []byte) ([]*ShareVerifier, []*ShamirShare, error)

func (Feldman) Verify

func (f Feldman) Verify(share *ShamirShare, verifiers []*ShareVerifier) (bool, error)

Verify checks a share for validity

type FeldmanResult

type FeldmanResult struct {
	SecretShares []*ShamirShare
	Verifiers    []*ShareVerifier
}

FeldmanResult contains all the data from calling Split

type Pedersen

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

Pedersen Verifiable Secret Sharing Scheme

func NewPedersen

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

NewPedersen creates a new pedersen VSS

func (Pedersen) Combine

func (pd Pedersen) Combine(shares ...*ShamirShare) ([]byte, error)

Combine recreates the original secret from the shares

func (Pedersen) Split

func (pd Pedersen) Split(secret []byte) (*PedersenResult, error)

Split creates the verifiers, blinding and shares

func (Pedersen) Verify

func (pd Pedersen) Verify(share *ShamirShare, blinding *ShamirShare, blindedverifiers []*ShareVerifier) (bool, error)

Verify checks a share for validity

type PedersenResult

type PedersenResult struct {
	Blinding                     *big.Int
	BlindingShares, SecretShares []*ShamirShare
	BlindedVerifiers             []*ShareVerifier
	Verifiers                    []*ShareVerifier
}

PedersenResult contains all the data from calling Split

type Shamir

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

Shamir is the Shamir secret sharing scheme

func NewShamir

func NewShamir(threshold, limit int, field *curves.Field) (*Shamir, error)

NewShamir creates a Shamir secret sharing scheme

func (*Shamir) Combine

func (s *Shamir) Combine(shares ...*ShamirShare) ([]byte, error)

Combine takes any number of shares and tries to combine them into the original secret

func (Shamir) ComputeL

func (s Shamir) ComputeL(shares ...*ShamirShare) ([]*curves.Element, error)

ComputeL is a function that computes all Lagrange coefficients. This function is particularly needed in FROST tSchnorr signature.

func (*Shamir) GetSharesAndPolynomial

func (s *Shamir) GetSharesAndPolynomial(secret []byte) ([]*ShamirShare, *polynomial, error)

getSharesAndPolynomial returns the shares for the specified secret and the polynomial used to create the shares

func (*Shamir) Interpolate

func (s *Shamir) Interpolate(xCoordinates, yCoordinates []*curves.Element) (*curves.Element, error)

interpolate calculates the lagrange interpolation

func (*Shamir) Split

func (s *Shamir) Split(secret []byte) ([]*ShamirShare, error)

Split takes a secret and splits it into multiple shares that requires threshold to reconstruct

type ShamirShare

type ShamirShare struct {
	// x-coordinate
	Identifier uint32 `json:"identifier"`
	// y-coordinate
	Value *curves.Element `json:"value"`
}

ShamirShare is the data from splitting a secret

func NewShamirShare

func NewShamirShare(x uint32, y []byte, f *curves.Field) *ShamirShare

NewShamirShare creates a ShamirShare given the Identifier, value, and Field for the value

func (ShamirShare) Add

func (s ShamirShare) Add(other *ShamirShare) *ShamirShare

Add returns the sum of two Shamir shares

func (ShamirShare) Bytes

func (s ShamirShare) Bytes() []byte

Bytes returns the representation of the share in bytes with the identifier as the first 4 bytes

type ShareVerifier

type ShareVerifier = kryptology.EcPoint

ShareVerifier is used to verify secret shares from Feldman or Pedersen VSS

Jump to

Keyboard shortcuts

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