polynomial

package
v0.0.0-...-05710c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lagrange

func Lagrange(group curve.Curve, interpolationDomain []party.ID) map[party.ID]curve.Scalar

Lagrange returns the Lagrange coefficients at 0 for all parties in the interpolation domain.

func LagrangeFor

func LagrangeFor(group curve.Curve, interpolationDomain []party.ID, subset ...party.ID) map[party.ID]curve.Scalar

LagrangeFor returns the Lagrange coefficients at 0 for all parties in the given subset.

func LagrangeSingle

func LagrangeSingle(group curve.Curve, interpolationDomain []party.ID, j party.ID) curve.Scalar

LagrangeSingle returns the lagrange coefficient at 0 of the party with index j.

Types

type Exponent

type Exponent struct {

	// IsConstant indicates that the constant coefficient is the identity.
	// We do this so that we never need to send an encoded Identity point, and thus consider it invalid
	IsConstant bool
	// contains filtered or unexported fields
}

Exponent represent a polynomial F(X) whose coefficients belong to a group 𝔾.

func EmptyExponent

func EmptyExponent(group curve.Curve) *Exponent

func NewPolynomialExponent

func NewPolynomialExponent(polynomial *Polynomial) *Exponent

NewPolynomialExponent generates an Exponent polynomial F(X) = [secret + a₁•X + … + aₜ•Xᵗ]•G, with coefficients in 𝔾, and degree t.

func Sum

func Sum(polynomials []*Exponent) (*Exponent, error)

Sum creates a new Polynomial in the Exponent, by summing a slice of existing ones.

func (*Exponent) Constant

func (p *Exponent) Constant() curve.Point

Constant returns the constant coefficient of the polynomial 'in the exponent'.

func (*Exponent) Degree

func (p *Exponent) Degree() int

Degree returns the degree t of the polynomial.

func (*Exponent) Domain

func (*Exponent) Domain() string

Domain implements hash.WriterToWithDomain, and separates this type within hash.Hash.

func (*Exponent) Equal

func (p *Exponent) Equal(other Exponent) bool

Equal returns true if p ≡ other.

func (*Exponent) Evaluate

func (p *Exponent) Evaluate(x curve.Scalar) curve.Point

Evaluate returns F(x) = [secret + a₁•x + … + aₜ•xᵗ]•G.

func (*Exponent) MarshalBinary

func (e *Exponent) MarshalBinary() ([]byte, error)

func (*Exponent) UnmarshalBinary

func (e *Exponent) UnmarshalBinary(data []byte) error

func (*Exponent) WriteTo

func (p *Exponent) WriteTo(w io.Writer) (int64, error)

WriteTo implements io.WriterTo and should be used within the hash.Hash function.

type Polynomial

type Polynomial struct {
	// contains filtered or unexported fields
}

Polynomial represents f(X) = a₀ + a₁⋅X + … + aₜ⋅Xᵗ.

func NewPolynomial

func NewPolynomial(group curve.Curve, degree int, constant curve.Scalar) *Polynomial

NewPolynomial generates a Polynomial f(X) = secret + a₁⋅X + … + aₜ⋅Xᵗ, with coefficients in ℤₚ, and degree t.

func (*Polynomial) Constant

func (p *Polynomial) Constant() curve.Scalar

Constant returns a reference to the constant coefficient of the polynomial.

func (*Polynomial) Degree

func (p *Polynomial) Degree() uint32

Degree is the highest power of the Polynomial.

func (*Polynomial) Evaluate

func (p *Polynomial) Evaluate(index curve.Scalar) curve.Scalar

Evaluate evaluates a polynomial in a given variable index We use Horner's method: https://en.wikipedia.org/wiki/Horner%27s_method

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL