MCPcopy Create free account
hub / github.com/DOSNetwork/core / Eval

Method Eval

share/poly.go:78–86  ·  view source on GitHub ↗

Eval computes the private share v = p(i).

(i int)

Source from the content-addressed store, hash-verified

76
77// Eval computes the private share v = p(i).
78func (p *PriPoly) Eval(i int) *PriShare {
79 xi := p.g.Scalar().SetInt64(1 + int64(i))
80 v := p.g.Scalar().Zero()
81 for j := p.Threshold() - 1; j >= 0; j-- {
82 v.Mul(v, xi)
83 v.Add(v, p.coeffs[j])
84 }
85 return &PriShare{i, v}
86}
87
88// Shares creates a list of n private shares p(1),...,p(n).
89func (p *PriPoly) Shares(n int) []*PriShare {

Callers 5

SharesMethod · 0.95
TestRecoverPriPolyFunction · 0.95
NewDealerFunction · 0.95
VerifyFunction · 0.45
RecoverFunction · 0.45

Calls 6

ThresholdMethod · 0.95
SetInt64Method · 0.45
ScalarMethod · 0.45
ZeroMethod · 0.45
MulMethod · 0.45
AddMethod · 0.45

Tested by 1

TestRecoverPriPolyFunction · 0.76