internal

package
v0.0.0-...-9a9e30f Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package internal provides values, structures, and functions to operate FROST that are not part of the public API.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidParameters indicates that wrong input has been provided.
	ErrInvalidParameters = errors.New("invalid parameters")

	// ErrInvalidCiphersuite indicates a non-supported ciphersuite is being used.
	ErrInvalidCiphersuite = errors.New("ciphersuite not available")

	// ErrInvalidParticipantBackup indicates the participant's encoded backup is not valid.
	ErrInvalidParticipantBackup = errors.New("invalid backup")
)

Functions

func Concatenate

func Concatenate(input ...[]byte) []byte

Concatenate returns the concatenation of all bytes composing the input elements.

func IntegerToScalar

func IntegerToScalar(g group.Group, i int) *group.Scalar

IntegerToScalar creates a group.Scalar given an int.

func RandomBytes

func RandomBytes(length int) []byte

RandomBytes returns length random bytes (wrapper for crypto/rand).

Types

type BindingFactor

type BindingFactor struct {
	Identifier    *group.Scalar
	BindingFactor *group.Scalar
}

BindingFactor holds the binding factor scalar for the given identifier.

type BindingFactorList

type BindingFactorList []*BindingFactor

BindingFactorList a list of BindingFactor.

func (BindingFactorList) BindingFactorForParticipant

func (b BindingFactorList) BindingFactorForParticipant(id *group.Scalar) *group.Scalar

BindingFactorForParticipant returns the binding factor for a given participant identifier in the list.

type Ciphersuite

type Ciphersuite struct {
	ContextString []byte
	Hash          hash.Hashing
	Group         group.Group
}

Ciphersuite combines the group and hashing routines.

func (Ciphersuite) H1

func (c Ciphersuite) H1(input []byte) *group.Scalar

H1 hashes the input and proves the "rho" DST.

func (Ciphersuite) H2

func (c Ciphersuite) H2(input []byte) *group.Scalar

H2 hashes the input and proves the "chal" DST.

func (Ciphersuite) H3

func (c Ciphersuite) H3(input []byte) *group.Scalar

H3 hashes the input and proves the "nonce" DST.

func (Ciphersuite) H4

func (c Ciphersuite) H4(msg []byte) []byte

H4 hashes the input and proves the "msg" DST.

func (Ciphersuite) H5

func (c Ciphersuite) H5(msg []byte) []byte

H5 hashes the input and proves the "com" DST.

func (Ciphersuite) HDKG

func (c Ciphersuite) HDKG(msg []byte) *group.Scalar

HDKG hashes the input to the "dkg" DST.

type Commitment

type Commitment struct {
	ID           *group.Scalar
	HidingNonce  *group.Element
	BindingNonce *group.Element
}

Commitment represent a participant's commitment.

type CommitmentList

type CommitmentList []*Commitment

CommitmentList is a sortable list of commitments.

func (CommitmentList) ComputeBindingFactors

func (c CommitmentList) ComputeBindingFactors(cs Ciphersuite, msg []byte) (l BindingFactorList, r [][]byte)

ComputeBindingFactors computes binding factors based on the participant commitment list and the message to be signed. The rhoInputs are temporarily added for testing purposes and can be ignored.

func (CommitmentList) ComputeGroupCommitment

func (c CommitmentList) ComputeGroupCommitment(cs Ciphersuite, list BindingFactorList) *group.Element

ComputeGroupCommitment creates the group commitment from a commitment list.

func (CommitmentList) Encode

func (c CommitmentList) Encode() []byte

Encode serializes a whole commitment list.

func (CommitmentList) IsSorted

func (c CommitmentList) IsSorted() bool

IsSorted returns whether the list is sorted in ascending order by identifier.

func (CommitmentList) Len

func (c CommitmentList) Len() int

Len implements the sort.Interface Len method.

func (CommitmentList) Less

func (c CommitmentList) Less(i, j int) bool

Less implements the sort.Interface Less method.

func (CommitmentList) Participants

func (c CommitmentList) Participants() []*group.Scalar

Participants returns the list of participants in the commitment list.

func (CommitmentList) Sort

func (c CommitmentList) Sort()

Sort sorts the list the ascending order of identifiers.

func (CommitmentList) Swap

func (c CommitmentList) Swap(i, j int)

Swap implements the sort.Interface Swap method.

Directories

Path Synopsis
Package schnorr provides Schnorr signature operations.
Package schnorr provides Schnorr signature operations.

Jump to

Keyboard shortcuts

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