Documentation ¶
Overview ¶
Matrix operations for elements in GF(2^128).
Polynomial fields with coefficients in GF(2)
Index ¶
- Variables
- type Condition
- type FieldElem
- func (e FieldElem) Add(f FieldElem) FieldElem
- func (e FieldElem) AddM(f FieldElem)
- func (e FieldElem) Dup() FieldElem
- func (e FieldElem) Exp(i int) FieldElem
- func (e FieldElem) Invert() FieldElem
- func (e FieldElem) IsOne() bool
- func (e FieldElem) IsZero() bool
- func (e FieldElem) Mul(f FieldElem) FieldElem
- type Formatted
- type MSP
- type Matrix
- type Name
- type NodeType
- type Raw
- type Row
- type TraceElem
- type TraceSlice
- type UserDatabase
Constants ¶
This section is empty.
Variables ¶
var ( Modulus FieldElem = []byte{135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // x^128 + x^7 + x^2 + x + 1 ModulusSize int = 16 ModulusBitSize int = 128 Zero FieldElem = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} One FieldElem = []byte{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} )
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition interface {
Ok(*UserDatabase) bool
}
type FieldElem ¶
type FieldElem []byte
type Formatted ¶
func StringToFormatted ¶
func (Formatted) Ok ¶
func (f Formatted) Ok(db *UserDatabase) bool
type MSP ¶
type MSP Formatted
func StringToMSP ¶
func (MSP) DerivePath ¶
DerivePath returns the cheapest way to satisfy the MSP (the one with the minimal number of delegations).
ok: True if the MSP can be satisfied with current delegations; false if not. names: The names in the top-level threshold gate that need to be delegated. locs: The index in the treshold gate for each name. trace: All names that must be delegated for for this gate to be satisfied.
func (MSP) DistributeShares ¶
DistributeShares takes as input a secret and a user database and returns secret shares according to access structure described by the MSP.
func (MSP) RecoverSecret ¶
func (m MSP) RecoverSecret(db *UserDatabase) ([]byte, error)
RecoverSecret takes a user database storing secret shares as input and returns the original secret.
type Matrix ¶
type Matrix []Row
type Name ¶
type Name struct {
// contains filtered or unexported fields
}
func (Name) Ok ¶
func (n Name) Ok(db *UserDatabase) bool
type Row ¶
type Row []FieldElem
func (Row) DotProduct ¶
DotProduct computes the dot product of two vectors.
type TraceSlice ¶
type TraceSlice []TraceElem
func (TraceSlice) Compact ¶
func (ts TraceSlice) Compact() (index []int, names []string, trace []string)
Compact takes a trace slice and merges all of its fields.
index: Union of all locations in the slice. names: Union of all names in the slice. trace: Union of all the traces in the slice.
func (TraceSlice) Len ¶
func (ts TraceSlice) Len() int
func (TraceSlice) Less ¶
func (ts TraceSlice) Less(i, j int) bool
func (*TraceSlice) Pop ¶
func (ts *TraceSlice) Pop() interface{}
func (*TraceSlice) Push ¶
func (ts *TraceSlice) Push(te interface{})
func (TraceSlice) Swap ¶
func (ts TraceSlice) Swap(i, j int)
type UserDatabase ¶
A UserDatabase is an abstraction over the name -> share map returned by the secret splitter that allows an application to only decrypt or request shares when needed, rather than re-build a partial map of known data.