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

Function NewPriPoly

share/poly.go:50–60  ·  view source on GitHub ↗

NewPriPoly creates a new secret sharing polynomial using the provided cryptographic group, the secret sharing threshold t, and the secret to be shared s. If s is nil, a new s is chosen using the provided randomness stream rand.

(group kyber.Group, t int, s kyber.Scalar, rand cipher.Stream)

Source from the content-addressed store, hash-verified

48// shared s. If s is nil, a new s is chosen using the provided randomness
49// stream rand.
50func NewPriPoly(group kyber.Group, t int, s kyber.Scalar, rand cipher.Stream) *PriPoly {
51 coeffs := make([]kyber.Scalar, t)
52 coeffs[0] = s
53 if coeffs[0] == nil {
54 coeffs[0] = group.Scalar().Pick(rand)
55 }
56 for i := 1; i < t; i++ {
57 coeffs[i] = group.Scalar().Pick(rand)
58 }
59 return &PriPoly{g: group, coeffs: coeffs}
60}
61
62// CoefficientsToPriPoly returns a PriPoly based on the given coefficients
63func CoefficientsToPriPoly(g kyber.Group, coeffs []kyber.Scalar) *PriPoly {

Callers 14

TestSecretRecoveryFunction · 0.85
TestSecretRecoveryDeleteFunction · 0.85
TestSecretPolyEqualFunction · 0.85
TestPublicCheckFunction · 0.85
TestPublicRecoveryFunction · 0.85
TestPublicRecoveryDeleteFunction · 0.85
TestPrivateAddFunction · 0.85
TestPublicAddFunction · 0.85
TestPublicPolyEqualFunction · 0.85
TestPriPolyMulFunction · 0.85

Calls 2

PickMethod · 0.45
ScalarMethod · 0.45

Tested by 14

TestSecretRecoveryFunction · 0.68
TestSecretRecoveryDeleteFunction · 0.68
TestSecretPolyEqualFunction · 0.68
TestPublicCheckFunction · 0.68
TestPublicRecoveryFunction · 0.68
TestPublicRecoveryDeleteFunction · 0.68
TestPrivateAddFunction · 0.68
TestPublicAddFunction · 0.68
TestPublicPolyEqualFunction · 0.68
TestPriPolyMulFunction · 0.68