[][src]Struct threshold_crypto::poly::Poly

pub struct Poly { /* fields omitted */ }

A univariate polynomial in the prime field.

Methods

impl Poly[src]

pub fn random<R: Rng>(degree: usize, rng: &mut R) -> Self[src]

Creates a random polynomial.

Panics

Panics if the degree is too large for the coefficients to fit into a Vec.

pub fn try_random<R: Rng>(degree: usize, rng: &mut R) -> Result<Self>[src]

Creates a random polynomial. This constructor is identical to the Poly::random() constructor in every way except that this constructor will return an Err where try_random would return an error.

pub fn zero() -> Self[src]

Returns the polynomial with constant value 0.

pub fn is_zero(&self) -> bool[src]

Returns true if the polynomial is the constant value 0.

pub fn one() -> Self[src]

Returns the polynomial with constant value 1.

pub fn constant(c: Fr) -> Self[src]

Returns the polynomial with constant value c.

pub fn identity() -> Self[src]

Returns the identity function, i.e. the polynomial "x".

pub fn monomial(degree: usize) -> Self[src]

Returns the (monic) monomial: x.pow(degree).

pub fn interpolate<T, U, I>(samples_repr: I) -> Self where
    I: IntoIterator<Item = (T, U)>,
    T: IntoFr,
    U: IntoFr
[src]

Returns the unique polynomial f of degree samples.len() - 1 with the given values (x, f(x)).

pub fn degree(&self) -> usize[src]

Returns the degree.

pub fn evaluate<T: IntoFr>(&self, i: T) -> Fr[src]

Returns the value at the point i.

pub fn commitment(&self) -> Commitment[src]

Returns the corresponding commitment.

pub fn reveal(&self) -> String[src]

Generates a non-redacted debug string. This method differs from the Debug implementation in that it does leak the secret prime field elements.

Trait Implementations

impl Clone for Poly[src]

Creates a new Poly with the same coefficients as another polynomial.

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl From<Vec<Fr>> for Poly[src]

Creates a new Poly instance from a vector of prime field elements representing the coefficients of the polynomial.

impl From<Poly> for SecretKeySet[src]

impl PartialEq<Poly> for Poly[src]

impl Drop for Poly[src]

impl Eq for Poly[src]

impl Debug for Poly[src]

A debug statement where the coeff vector of prime field elements has been redacted.

impl<'a, B: Borrow<Poly>> Add<B> for &'a Poly[src]

type Output = Poly

The resulting type after applying the + operator.

impl<B: Borrow<Poly>> Add<B> for Poly[src]

type Output = Poly

The resulting type after applying the + operator.

impl<'a> Add<Fr> for Poly[src]

type Output = Poly

The resulting type after applying the + operator.

impl<'a> Add<u64> for Poly[src]

type Output = Poly

The resulting type after applying the + operator.

impl<'a, B: Borrow<Poly>> Sub<B> for &'a Poly[src]

type Output = Poly

The resulting type after applying the - operator.

impl<B: Borrow<Poly>> Sub<B> for Poly[src]

type Output = Poly

The resulting type after applying the - operator.

impl<'a> Sub<Fr> for Poly[src]

type Output = Poly

The resulting type after applying the - operator.

impl<'a> Sub<u64> for Poly[src]

type Output = Poly

The resulting type after applying the - operator.

impl<'a, B: Borrow<Poly>> Mul<B> for &'a Poly[src]

type Output = Poly

The resulting type after applying the * operator.

impl<B: Borrow<Poly>> Mul<B> for Poly[src]

type Output = Poly

The resulting type after applying the * operator.

impl<'a> Mul<&'a Fr> for Poly[src]

type Output = Poly

The resulting type after applying the * operator.

impl Mul<Fr> for Poly[src]

type Output = Poly

The resulting type after applying the * operator.

impl<'a> Mul<&'a Fr> for &'a Poly[src]

type Output = Poly

The resulting type after applying the * operator.

impl<'a> Mul<Fr> for &'a Poly[src]

type Output = Poly

The resulting type after applying the * operator.

impl Mul<u64> for Poly[src]

type Output = Poly

The resulting type after applying the * operator.

impl<B: Borrow<Poly>> AddAssign<B> for Poly[src]

impl<B: Borrow<Poly>> SubAssign<B> for Poly[src]

impl<B: Borrow<Self>> MulAssign<B> for Poly[src]

impl MulAssign<Fr> for Poly[src]

impl Serialize for Poly[src]

impl<'de> Deserialize<'de> for Poly[src]

Auto Trait Implementations

impl Sync for Poly

impl Send for Poly

impl Unpin for Poly

impl RefUnwindSafe for Poly

impl UnwindSafe for Poly

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]