polynomial

package
v0.0.0-...-5abc84a Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exponent

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

Exponent represents a polynomial whose coefficients are points on an elliptic curve.

func NewPolynomialExponent

func NewPolynomialExponent(polynomial *Polynomial) *Exponent

NewPolynomialExponent generates a PolynomialExponent F(X) = secret•G + a1*X•G + ... + at*X^t•G, with coefficients in Z_q, 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) Add

func (p *Exponent) Add(q *Exponent) error

Add performs coefficient-wise addition of the coefficients of p and q, and sets p to the resulting polynomial Returns an error if the length of the coefficients are different

func (*Exponent) BytesAppend

func (p *Exponent) BytesAppend(existing []byte) (data []byte, err error)

func (*Exponent) Constant

func (p *Exponent) Constant() *ristretto.Element

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

func (*Exponent) Copy

func (p *Exponent) Copy() *Exponent

Copy returns a deep copy of p

func (*Exponent) Degree

func (p *Exponent) Degree() party.Size

Degree returns the degree of the polynomial, the integer t such that p = F(X) = a_0•G + a_1*X•G + ... + a_t * X^t•G

func (*Exponent) Equal

func (p *Exponent) Equal(other interface{}) bool

func (*Exponent) Evaluate

func (p *Exponent) Evaluate(index *ristretto.Scalar) *ristretto.Element

Evaluate uses any one of the defined evaluation algorithms

func (*Exponent) EvaluateMulti

func (p *Exponent) EvaluateMulti(indices []party.ID) map[party.ID]*ristretto.Element

EvaluateMulti evaluates a polynomial in a many given points.

func (*Exponent) MarshalBinary

func (p *Exponent) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

func (*Exponent) Reset

func (p *Exponent) Reset()

Reset sets all coefficients to 0

func (*Exponent) Size

func (p *Exponent) Size() int

func (*Exponent) UnmarshalBinary

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

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

type Polynomial

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

func NewPolynomial

func NewPolynomial(degree party.Size, constant *ristretto.Scalar) *Polynomial

NewPolynomial generates a Polynomial f(X) = secret + a1*X + ... + at*X^t, with coefficients in Z_q, and degree t.

func (*Polynomial) Constant

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

func (*Polynomial) Degree

func (p *Polynomial) Degree() party.Size

Degree is the highest power of the Polynomial

func (*Polynomial) Evaluate

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

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

func (*Polynomial) Reset

func (p *Polynomial) Reset()

Reset sets all coefficients to 0

func (*Polynomial) Size

func (p *Polynomial) Size() int

Size is the number of coefficients of the polynomial It is equal to Degree+1

Jump to

Keyboard shortcuts

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