[−][src]Struct threshold_crypto::poly::Poly
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]
I: IntoIterator<Item = (T, U)>,
T: IntoFr,
U: IntoFr,
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(&self) -> Self
[src]
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]
fn from(poly: Poly) -> 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.
fn add(self, rhs: B) -> Poly
[src]
impl<B: Borrow<Poly>> Add<B> for Poly
[src]
type Output = Poly
The resulting type after applying the +
operator.
fn add(self, rhs: B) -> Poly
[src]
impl<'a> Add<Fr> for Poly
[src]
type Output = Poly
The resulting type after applying the +
operator.
fn add(self, rhs: Fr) -> Self::Output
[src]
impl<'a> Add<u64> for Poly
[src]
type Output = Poly
The resulting type after applying the +
operator.
fn add(self, rhs: u64) -> Self::Output
[src]
impl<'a, B: Borrow<Poly>> Sub<B> for &'a Poly
[src]
type Output = Poly
The resulting type after applying the -
operator.
fn sub(self, rhs: B) -> Poly
[src]
impl<B: Borrow<Poly>> Sub<B> for Poly
[src]
type Output = Poly
The resulting type after applying the -
operator.
fn sub(self, rhs: B) -> Poly
[src]
impl<'a> Sub<Fr> for Poly
[src]
type Output = Poly
The resulting type after applying the -
operator.
fn sub(self, rhs: Fr) -> Self::Output
[src]
impl<'a> Sub<u64> for Poly
[src]
type Output = Poly
The resulting type after applying the -
operator.
fn sub(self, rhs: u64) -> Self::Output
[src]
impl<'a, B: Borrow<Poly>> Mul<B> for &'a Poly
[src]
type Output = Poly
The resulting type after applying the *
operator.
fn mul(self, rhs: B) -> Self::Output
[src]
impl<B: Borrow<Poly>> Mul<B> for Poly
[src]
type Output = Poly
The resulting type after applying the *
operator.
fn mul(self, rhs: B) -> Self::Output
[src]
impl<'a> Mul<&'a Fr> for Poly
[src]
type Output = Poly
The resulting type after applying the *
operator.
fn mul(self, rhs: &Fr) -> Self::Output
[src]
impl Mul<Fr> for Poly
[src]
type Output = Poly
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> Self::Output
[src]
impl<'a> Mul<&'a Fr> for &'a Poly
[src]
type Output = Poly
The resulting type after applying the *
operator.
fn mul(self, rhs: &Fr) -> Self::Output
[src]
impl<'a> Mul<Fr> for &'a Poly
[src]
type Output = Poly
The resulting type after applying the *
operator.
fn mul(self, rhs: Fr) -> Self::Output
[src]
impl Mul<u64> for Poly
[src]
type Output = Poly
The resulting type after applying the *
operator.
fn mul(self, rhs: u64) -> Self::Output
[src]
impl<B: Borrow<Poly>> AddAssign<B> for Poly
[src]
fn add_assign(&mut self, rhs: B)
[src]
impl<B: Borrow<Poly>> SubAssign<B> for Poly
[src]
fn sub_assign(&mut self, rhs: B)
[src]
impl<B: Borrow<Self>> MulAssign<B> for Poly
[src]
fn mul_assign(&mut self, rhs: B)
[src]
impl MulAssign<Fr> for Poly
[src]
fn mul_assign(&mut self, rhs: Fr)
[src]
impl Serialize for Poly
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Poly
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,