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

Function TestSecretRecovery

share/poly_test.go:14–28  ·  view source on GitHub ↗
(test *testing.T)

Source from the content-addressed store, hash-verified

12var suite = suites.MustFind("bn256")
13
14func TestSecretRecovery(test *testing.T) {
15 n := 10
16 t := n/2 + 1
17 poly := NewPriPoly(suite, t, nil, suite.RandomStream())
18 shares := poly.Shares(n)
19
20 recovered, err := RecoverSecret(suite, shares, t, n)
21 if err != nil {
22 test.Fatal(err)
23 }
24
25 if !recovered.Equal(poly.Secret()) {
26 test.Fatal("recovered secret does not match initial value")
27 }
28}
29
30func TestSecretRecoveryDelete(test *testing.T) {
31 n := 10

Callers

nothing calls this directly

Calls 7

SharesMethod · 0.95
SecretMethod · 0.95
NewPriPolyFunction · 0.85
RecoverSecretFunction · 0.70
FatalMethod · 0.65
RandomStreamMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected