LagrangePolynomial

Struct LagrangePolynomial 

Source
pub struct LagrangePolynomial<I, O> {
    pub evaluations: Vec<Evaluation<I, O>>,
}

Fields§

§evaluations: Vec<Evaluation<I, O>>

Implementations§

Source§

impl<I, O> LagrangePolynomial<I, O>

Source

pub fn new(evaluations: Vec<Evaluation<I, O>>) -> Self

The evaluations are expected to have distinct input values. If two or more evaluations reuse the same input, evaluation and share-issuance will cause panics.

Source§

impl LagrangePolynomial<MaybeScalar, MaybeScalar>

Source

pub fn issue_share(&self, x: MaybeScalar) -> SecretShare

Issue a share at the given input x.

Source§

impl LagrangePolynomial<MaybeScalar, MaybePoint>

Source

pub fn issue_share(&self, x: MaybeScalar) -> PointShare

Issue a share at the given input x.

Source§

impl LagrangePolynomial<MaybeScalar, MaybePoint>

Source

pub fn derive_secret(&self, x: MaybeScalar) -> [u8; 32]

Derive a secret c by hashing the output point produced by evaluating the polynomial on x.

Trait Implementations§

Source§

impl Mul<&LagrangePolynomial<MaybeScalar, MaybeScalar>> for G

Allows multiplying an interpolated secret-sharing polynomial by the secp256k1 generator point.

Source§

type Output = LagrangePolynomial<MaybeScalar, MaybePoint>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &InterpolatedSecretPolynomial) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<&LagrangePolynomial<MaybeScalar, MaybeScalar>> for Point

Allows multiplying an interpolated secret-sharing polynomial by a given fixed point.

Source§

type Output = LagrangePolynomial<MaybeScalar, MaybePoint>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &InterpolatedSecretPolynomial) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<LagrangePolynomial<MaybeScalar, MaybeScalar>> for G

Source§

type Output = LagrangePolynomial<MaybeScalar, MaybePoint>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: InterpolatedSecretPolynomial) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<LagrangePolynomial<MaybeScalar, MaybeScalar>> for Point

Source§

type Output = LagrangePolynomial<MaybeScalar, MaybePoint>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: InterpolatedSecretPolynomial) -> Self::Output

Performs the * operation. Read more
Source§

impl<I, O> Polynomial<I, O> for LagrangePolynomial<I, O>
where I: Copy + PartialEq + One + Zero + Sub<I, Output = I> + UnsafeDiv<I, Output = I> + Mul<I, Output = I>, O: Copy + Zero + Mul<I, Output = O> + Add<O, Output = O>,

Source§

fn evaluate(&self, x: I) -> O

Evaluate the polynomial on a given input.
Source§

fn degree(&self) -> usize

Returns the degree of the polynomial, which is usually the number of coefficients minus 1. If the polynomial has no coefficients, it has degree zero.
Source§

fn interpolation_threshold(&self) -> usize

Returns the number of evaluations needed to interpolate this polynomial, which is just the number of coefficients in the polynomial.

Auto Trait Implementations§

§

impl<I, O> Freeze for LagrangePolynomial<I, O>

§

impl<I, O> RefUnwindSafe for LagrangePolynomial<I, O>

§

impl<I, O> Send for LagrangePolynomial<I, O>
where I: Send, O: Send,

§

impl<I, O> Sync for LagrangePolynomial<I, O>
where I: Sync, O: Sync,

§

impl<I, O> Unpin for LagrangePolynomial<I, O>
where I: Unpin, O: Unpin,

§

impl<I, O> UnwindSafe for LagrangePolynomial<I, O>
where I: UnwindSafe, O: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.