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

Method Add

share/poly.go:351–366  ·  view source on GitHub ↗

Add computes the component-wise sum of the polynomials p and q and returns it as a new polynomial. NOTE: If the base points p.b and q.b are different then the base point of the resulting PubPoly cannot be computed without knowing the discrete logarithm between p.b and q.b. In this particular case, w

(q *PubPoly)

Source from the content-addressed store, hash-verified

349// p.b as a default value which of course does not correspond to the correct
350// base point and thus should not be used in further computations.
351func (p *PubPoly) Add(q *PubPoly) (*PubPoly, error) {
352 if p.g.String() != q.g.String() {
353 return nil, errorGroups
354 }
355
356 if p.Threshold() != q.Threshold() {
357 return nil, errorCoeffs
358 }
359
360 commits := make([]kyber.Point, p.Threshold())
361 for i := range commits {
362 commits[i] = p.g.Point().Add(p.commits[i], q.commits[i])
363 }
364
365 return &PubPoly{p.g, p.b, commits}, nil
366}
367
368// Equal checks equality of two public commitment polynomials p and q. If p and
369// q are trivially unequal (e.g., due to mismatching cryptographic groups),

Callers 1

DistKeyShareMethod · 0.95

Calls 5

ThresholdMethod · 0.95
StringMethod · 0.45
ThresholdMethod · 0.45
AddMethod · 0.45
PointMethod · 0.45

Tested by

no test coverage detected