Documentation
¶
Overview ¶
Package additive implements additive secret sharing over arbitrary groups.
In additive secret sharing, a secret s is split into n shares s_1, ..., s_n such that s = s_1 + s_2 + ... + s_n (using the group operation). This is an n-of-n scheme: all shares are required to reconstruct the secret.
Additive sharing is information-theoretically secure: any proper subset of shares reveals no information about the secret. It is commonly used as a building block in MPC protocols and as the target representation when converting Shamir shares via Lagrange coefficients.
Index ¶
- Constants
- Variables
- type DealerOutput
- type Group
- type GroupElement
- type Scheme
- func (d *Scheme[E]) AccessStructure() *sharing.MinimalQualifiedAccessStructure
- func (d *Scheme[E]) Deal(secret *Secret[E], prng io.Reader) (*DealerOutput[E], error)
- func (d *Scheme[E]) DealRandom(prng io.Reader) (*DealerOutput[E], *Secret[E], error)
- func (*Scheme[E]) Name() sharing.Name
- func (d *Scheme[E]) Reconstruct(shares ...*Share[E]) (*Secret[E], error)
- type Secret
- type Share
- func (s *Share[E]) Add(other *Share[E]) *Share[E]
- func (s *Share[E]) Clone() *Share[E]
- func (s *Share[E]) Equal(other *Share[E]) bool
- func (s *Share[E]) HashCode() base.HashCode
- func (s *Share[E]) ID() sharing.ID
- func (s *Share[E]) Op(other *Share[E]) *Share[E]
- func (*Share[E]) SchemeName() sharing.Name
- func (s *Share[E]) Value() E
Constants ¶
const Name sharing.Name = "Additive Secret Sharing Scheme"
Name is the canonical name of this secret sharing scheme.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DealerOutput ¶
type DealerOutput[E GroupElement[E]] struct {
// contains filtered or unexported fields
}
DealerOutput contains the result of an additive dealing operation: a map from shareholder IDs to their corresponding shares.
type Group ¶
type Group[E GroupElement[E]] algebra.FiniteGroup[E]
Group is a finite group over which additive sharing can be performed.
type GroupElement ¶
type GroupElement[E algebra.GroupElement[E]] algebra.GroupElement[E]
GroupElement is an element of a group that supports the group operation.
type Scheme ¶
type Scheme[E GroupElement[E]] struct {
// contains filtered or unexported fields
}
Scheme implements additive secret sharing over a finite group.
func NewScheme ¶
NewScheme creates a new additive secret sharing scheme.
Parameters:
- g: The group over which sharing is performed
- shareholders: Set of shareholder IDs who will receive shares (all required for reconstruction)
func (*Scheme[E]) AccessStructure ¶
func (d *Scheme[E]) AccessStructure() *sharing.MinimalQualifiedAccessStructure
AccessStructure returns the access structure (all shareholders required).
func (*Scheme[E]) Deal ¶
Deal creates shares for the given secret. All but one share are sampled randomly, and the final share is computed to ensure s_1 + s_2 + ... + s_n = s.
func (*Scheme[E]) DealRandom ¶
DealRandom generates shares for a randomly sampled secret.
type Secret ¶
type Secret[E GroupElement[E]] struct {
// contains filtered or unexported fields
}
Secret wraps a group element that is being shared.
func NewSecret ¶
func NewSecret[E GroupElement[E]](v E) *Secret[E]
NewSecret creates a new secret from a group element.
type Share ¶
type Share[E GroupElement[E]] struct {
// contains filtered or unexported fields
}
Share represents an additive secret share consisting of a shareholder ID and a group element value.
func NewShare ¶
func NewShare[E GroupElement[E]](id sharing.ID, v E, ac *sharing.MinimalQualifiedAccessStructure) (*Share[E], error)
NewShare creates a new additive share with the given ID and value. If an access structure is provided, validates that the ID is a valid shareholder.
func (*Share[E]) Add ¶
Add returns a new share that is the component-wise sum of two shares. Both shares must have the same ID.
func (*Share[E]) HashCode ¶
HashCode returns a hash code for this share, for use in hash-based collections.
func (*Share[E]) SchemeName ¶
SchemeName returns the name of the secret sharing scheme.