smpc

package
v0.0.0-...-1e2cef0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: GPL-2.0, GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EC256K1 string = "EC256K1"
View Source
const EC256STARK string = "EC256STARK"
View Source
const ED25519 string = "ED25519"
View Source
const SR25519 string = "SR25519"

Variables

View Source
var VALID_SIG_TYPES = []string{EC256K1, ED25519, EC256STARK, SR25519}

Functions

func BaseStart

func BaseStart(p DNode) error

BaseStart begin to run first round

func BaseUpdate

func BaseUpdate(p DNode, msg Message) (ok bool, err error)

BaseUpdate an implementation of Update that is shared across the different types of parties (keygen, signing, dynamic groups)

func DECDSASignCalcv

func DECDSASignCalcv(keytype string, r, deltaGammaGy, pkx, pky, R, S *big.Int, hashBytes []byte, invert bool) int

DECDSASignCalcv calc v of (r,s,v)

func GetRandomInt

func GetRandomInt(length int) *big.Int

GetRandomInt get random int

func IsInfinityPoint

func IsInfinityPoint(x *big.Int, y *big.Int) bool

func ReadBits

func ReadBits(bigint *big.Int, buf []byte)

ReadBits encodes the absolute value of bigint as big-endian bytes. Callers must ensure that buf has enough space. If buf is too short the result will be incomplete.

func Verify2

func Verify2(keytype string, r *big.Int, s *big.Int, v int32, message string, pkx *big.Int, pky *big.Int) bool

Verify2 Verify whether RSV is legal

Types

type BaseDNode

type BaseDNode struct {
	ID                string
	DNodeCountInGroup int
	ThresHold         int
	PaillierKeyLength int
	KeyType           string
	// contains filtered or unexported fields
}

BaseDNode the base type of LocalDNode

func (*BaseDNode) Round

func (p *BaseDNode) Round() Round

Round get the round of current dnode

type DNode

type DNode interface {
	Start() error
	Update(msg Message) (ok bool, err error)
	FirstRound() Round
	DNodeID() string
	StoreMessage(msg Message) (bool, error)
	DulMessage(msg Message) bool
	SetDNodeID(id string)
	Finalize() bool
	FinalizeRound() Round

	Round() Round
	// contains filtered or unexported methods
}

DNode base interface of local dnode

type Message

type Message interface {
	GetFromID() string // x,fi(x) ---> id,skui
	GetFromIndex() int
	GetToID() []string
	IsBroadcast() bool
	OutMap() map[string]string
	GetMsgType() string
}

Message P2P message for MPC calculation

type Round

type Round interface {
	Start() error
	CanAccept(msg Message) bool
	Update() (bool, error)
	NextRound() Round
	RoundNumber() int
	CanProceed() bool
	GetIDs() (SortableIDSSlice, error)
	GetDNodeIDIndex(id string) (int, error)
	ResetOK()
}

Round Calculation rounds of MPC algorithm

type SortableIDSSlice

type SortableIDSSlice []*big.Int

SortableIDSSlice type define []*big.Int

func (SortableIDSSlice) Len

func (s SortableIDSSlice) Len() int

func (SortableIDSSlice) Less

func (s SortableIDSSlice) Less(i, j int) bool

func (SortableIDSSlice) Swap

func (s SortableIDSSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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