cs

package
v0.0.0-...-4cc056f Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitteeSize

func CommitteeSize(totalNodeCount int64, failedTotalNodesPercentage int64, failureChance big.Rat) int

func Exp

func Exp(x kyber.Scalar, exponent int) kyber.Scalar

func IsNodeInConfig

func IsNodeInConfig(id int32, expectedPubKey []byte, nodes committee.Nodes) (int, error)

IsNodeInConfig returns whether the given node is in the config.

func ReconstructShare

func ReconstructShare(x2y Index2Share) kyber.Point

func SelectCommittee

func SelectCommittee(config committee.Config, seed []byte, size int) []int32

func VerifyConfig

func VerifyConfig(config committee.Config) error

func VerifyDecShare

func VerifyDecShare(pk, d, e kyber.Point, proof SerializedProof) error

Types

type Body

type Body struct {
	Commitments []committee.Commitment
}

func (Body) Bytes

func (b Body) Bytes() []byte

type Commitment

type Commitment struct {
	From        int32
	EncShares   []kyber.Point // n encrypted shares
	Commitments []kyber.Point // f+1 commitments
	Proofs      SerializedProofs
}

func (Commitment) ToRawForm

func (cmt Commitment) ToRawForm(from int32) (committee.Commitment, error)

type CommitteeSelection

type CommitteeSelection struct {
	SelectCommittee CommitteeSelector
	Logger          committee.Logger
	// contains filtered or unexported fields
}

func (*CommitteeSelection) GenerateKeyPair

func (cs *CommitteeSelection) GenerateKeyPair(rand io.Reader) (committee.PublicKey, committee.PrivateKey, error)

func (*CommitteeSelection) Initialize

func (cs *CommitteeSelection) Initialize(ID int32, privateKey committee.PrivateKey, nodes committee.Nodes) error

func (*CommitteeSelection) Process

func (*CommitteeSelection) VerifyCommitment

func (cs *CommitteeSelection) VerifyCommitment(commitment committee.Commitment) error

func (*CommitteeSelection) VerifyReconShare

func (cs *CommitteeSelection) VerifyReconShare(share committee.ReconShare) error

type CommitteeSelector

type CommitteeSelector func(config committee.Config, seed []byte) []int32

type DLEQ

type DLEQ struct {
	G1, H1, G2, H2 kyber.Point
	// contains filtered or unexported fields
}

DLEQ is a NIZK that proves/verifies there exists some scalar α such that: ∃ α | g₁^{α} = h₁ ∧ g₁^{α} = h₂

func (DLEQ) Prove

func (dleq DLEQ) Prove(alpha kyber.Scalar) (SerializedProof, error)

func (DLEQ) Verify

func (dleq DLEQ) Verify(proof SerializedProof) error

type DLEQBatch

type DLEQBatch []DLEQ

func (DLEQBatch) Prove

func (dleqs DLEQBatch) Prove(alphas []kyber.Scalar) (SerializedProofs, error)

func (DLEQBatch) Verify

func (dleqs DLEQBatch) Verify(proofs []SerializedProof) error
type Header struct {
	BodyDigest string
}

func (Header) Bytes

func (h Header) Bytes() []byte

type Index2Share

type Index2Share map[int64]kyber.Point

Index2Share maps an index in [1, n] to its share

type PVSS

type PVSS struct {
	Commitments          []kyber.Point // g^{α_i} for i from 0 to f
	EncryptedEvaluations []kyber.Point // {pk_i}^{p(i)} for i from 1 to n
	Proofs               SerializedProofs
}

func (*PVSS) Commit

func (pvss *PVSS) Commit(threshold int, pubKeys []kyber.Point) error

func (PVSS) VerifyCommit

func (pvss PVSS) VerifyCommit(pubKeys []kyber.Point) error

type SSS

type SSS struct {
	Threshold int
}

func (*SSS) LagrangeCoefficient

func (sss *SSS) LagrangeCoefficient(evaluatedAt int64, evaluationPoints ...int64) kyber.Scalar

type SerializedCommitment

type SerializedCommitment struct {
	Commitments [][]byte
	EncShares   [][]byte
}

func (*SerializedCommitment) FromBytes

func (scm *SerializedCommitment) FromBytes(bytes []byte) error

func (SerializedCommitment) ToBytes

func (scm SerializedCommitment) ToBytes() ([]byte, error)

type SerializedProof

type SerializedProof struct {
	R  []byte
	A1 []byte
	A2 []byte
}

func DecryptShare

func DecryptShare(pk kyber.Point, privateKey kyber.Scalar, e kyber.Point) (kyber.Point, SerializedProof, error)

func (*SerializedProof) Initialize

func (sp *SerializedProof) Initialize(bytes []byte) error

func (SerializedProof) ToBytes

func (sp SerializedProof) ToBytes() ([]byte, error)

type SerializedProofs

type SerializedProofs struct {
	Proofs []SerializedProof
}

func (*SerializedProofs) Initialize

func (sps *SerializedProofs) Initialize(bytes []byte) error

func (SerializedProofs) ToBytes

func (sps SerializedProofs) ToBytes() ([]byte, error)

type Source2Points

type Source2Points map[int32]kyber.Point

Source2Points defines curve points indexed by their source

func (Source2Points) SortedPoints

func (c2s Source2Points) SortedPoints() []kyber.Point

SortedShares returns the points sorted by their sources

type State

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

func (*State) Initialize

func (s *State) Initialize(rawState []byte) error

func (*State) String

func (s *State) String() string

func (*State) ToBytes

func (s *State) ToBytes() []byte

Jump to

Keyboard shortcuts

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