Documentation ¶
Index ¶
Constants ¶
const IDByteSize = 2
IDByteSize is the number of bytes required to store and ID or Size
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID uint16
ID represents the identifier of a particular party, encoded as a 16 bit unsigned integer. The ID 0 is considered invalid.
func FromBytes ¶
FromBytes reads the first party.IDByteSize bytes from b and creates an ID from it. Returns an error if b is too small to hold an ID
func RandID ¶
func RandID() ID
RandID returns a pseudo-random value as a ID from the default Source.
func (ID) Lagrange ¶
Lagrange gives the Lagrange coefficient lⱼ(x) for x = 0.
We iterate over all points in the set. To get the coefficients over a smaller set, you should first get a smaller subset.
The following formulas are taken from https://en.wikipedia.org/wiki/Lagrange_polynomial
( x - x₀) ... ( x - xₖ)
lⱼ(x) = ---------------------------
(xⱼ - x₀) ... (xⱼ - xₖ) x₀ ... xₖ
lⱼ(0) = ---------------------------
(x₀ - xⱼ) ... (xₖ - xⱼ)
returns an error if id is not included in partyIDs
func (ID) MarshalText ¶
MarshalText implements encoding/TextMarshaler interface
func (*ID) UnmarshalText ¶
UnmarshalText implements encoding/TextMarshaler interface Returns an error when the encoded text is too large
type IDSlice ¶
type IDSlice []ID
IDSlice is an alias for []ID
func NewIDSlice ¶
NewIDSlice returns an IDSlice which is the partyIDs sorted
func (IDSlice) IsSubsetOf ¶
IsSubsetOf is all elements in ids are in o