Skip to main content

Combine a secret

Before you can combine any secret shares, you have to configure a cyclic group to be used for Pedersen operations as is shown in Configure a cyclic group.

This example shows how to combine a secret with a (t,n)(t, n)-threshold scheme of (t,n)=((t, n) = ( schemeThreshold , schemeParts ))

import (
"github.com/matteoarella/pedersen"
)

schemeParts := 5
schemeThreshold := 3
group := /* cyclic group */
shares := /* retrieve shares parts from the shareholders */

p, err := pedersen.NewPedersen(schemeParts, schemeThreshold, pedersen.CyclicGroup(group))
if err != nil {
panic(err)
}

secret, err = p.Combine(shares)
if err != nil {
panic(err)
}