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

Method Eval

share/poly.go:326–334  ·  view source on GitHub ↗

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

(i int)

Source from the content-addressed store, hash-verified

324
325// Eval computes the public share v = p(i).
326func (p *PubPoly) Eval(i int) *PubShare {
327 xi := p.g.Scalar().SetInt64(1 + int64(i)) // x-coordinate of this share
328 v := p.g.Point().Null()
329 for j := p.Threshold() - 1; j >= 0; j-- {
330 v.Mul(xi, v)
331 v.Add(v, p.commits[j])
332 }
333 return &PubShare{i, v}
334}
335
336// Shares creates a list of n public commitment shares p(1),...,p(n).
337func (p *PubPoly) Shares(n int) []*PubShare {

Callers 3

SharesMethod · 0.95
CheckMethod · 0.95
VerifyDealMethod · 0.95

Calls 7

ThresholdMethod · 0.95
SetInt64Method · 0.45
ScalarMethod · 0.45
NullMethod · 0.45
PointMethod · 0.45
MulMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected