Struct ntru::types::NtruProdPoly [] [src]

pub struct NtruProdPoly {
    // some fields omitted
}

A product-form polynomial, i.e. a polynomial of the form f1*f2+f3 where f1,f2,f3 are very sparsely populated ternary polynomials.

Methods

impl NtruProdPoly
[src]

fn new(n: u16, f1: NtruTernPoly, f2: NtruTernPoly, f3: NtruTernPoly) -> NtruProdPoly

fn rand(n: u16, df1: u16, df2: u16, df3_ones: u16, df3_neg_ones: u16, rand_ctx: &NtruRandContext) -> Option<NtruProdPoly>

Random product-form polynomial

Generates a random product-form polynomial consisting of 3 random ternary polynomials. Parameters:

  • N: the number of coefficients, must be NTRU_MAX_DEGREE or less
  • df1: number of ones and negative ones in the first ternary polynomial
  • df2: number of ones and negative ones in the second ternary polynomial
  • df3_ones: number of ones ones in the third ternary polynomial
  • df3_neg_ones: number of negative ones in the third ternary polynomial
  • rand_ctx: a random number generator

fn to_int_poly(&self, modulus: u16) -> NtruIntPoly

Trait Implementations

impl Clone for NtruProdPoly
[src]

fn clone(&self) -> NtruProdPoly

Returns a copy of the value. Read more

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

Performs copy-assignment from source. Read more

impl PartialEq for NtruProdPoly
[src]

fn eq(&self, __arg_0: &NtruProdPoly) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &NtruProdPoly) -> bool

This method tests for !=.

impl Debug for NtruProdPoly
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Default for NtruProdPoly
[src]

fn default() -> NtruProdPoly

Returns the "default value" for a type. Read more