Struct ntru::types::NtruIntPoly
[−]
[src]
pub struct NtruIntPoly { // some fields omitted }
A polynomial with integer coefficients.
Methods
impl NtruIntPoly
[src]
fn new(coeffs: &[i16]) -> NtruIntPoly
Create a new NtruIntPoly
fn rand(n: u16, pow2q: u16, rand_ctx: &NtruRandContext) -> NtruIntPoly
Create a new random NtruIntPoly
fn from_arr(arr: &[u8], n: u16, q: u16) -> NtruIntPoly
Convert array to NtruIntPoly
fn get_coeffs(&self) -> &[i16]
Get the coefficients
fn set_coeffs(&mut self, coeffs: &[i16])
Set the coefficients
fn set_coeff(&mut self, index: usize, value: i16)
Set a coefficient
fn mod_mask(&mut self, mod_mask: u16)
fn to_arr_32(&self, params: &NtruEncParams) -> Box<[u8]>
fn to_arr_64(&self, params: &NtruEncParams) -> Box<[u8]>
fn to_arr_sse_2048(&self, params: &NtruEncParams) -> Box<[u8]>
fn mult_tern(&self, b: &NtruTernPoly, mod_mask: u16) -> (NtruIntPoly, bool)
General polynomial by ternary polynomial multiplication
Multiplies a NtruIntPoly by a NtruTernPoly. The number of coefficients must be the same for both polynomials. It also returns if the number of coefficients differ or not.
fn mult_tern_32(&self, b: &NtruTernPoly, mod_mask: u16) -> (NtruIntPoly, bool)
General polynomial by ternary polynomial multiplication
Multiplies a NtruIntPoly by a NtruTernPoly. The number of coefficients must be the same for both polynomials. Uses 32-bit arithmetic. It also returns if the number of coefficients differ or not.
fn mult_tern_64(&self, b: &NtruTernPoly, mod_mask: u16) -> (NtruIntPoly, bool)
General polynomial by ternary polynomial multiplication
Multiplies a NtruIntPoly by a NtruTernPoly. The number of coefficients must be the same for both polynomials. Uses 64-bit arithmetic. It also returns if the number of coefficients differ or not.
fn mult_tern_sse(&self, b: &NtruTernPoly, mod_mask: u16) -> (NtruIntPoly, bool)
General polynomial by ternary polynomial multiplication, SSSE3 version
Multiplies a NtruIntPoly by a NtruTernPoly. The number of coefficients must be the same for both polynomials. This variant requires SSSE3 support. It also returns if the number of coefficients differ or not.
fn add_tern(&self, b: &NtruTernPoly) -> NtruIntPoly
fn mult_prod(&self, b: &NtruProdPoly, mod_mask: u16) -> (NtruIntPoly, bool)
General polynomial by product-form polynomial multiplication
Multiplies a NtruIntPoly by a NtruProdPoly. The number of coefficients must be the same for both polynomials. It also returns if the number of coefficients differ or not.
fn mult_priv(&self, b: &NtruPrivPoly, mod_mask: u16) -> (NtruIntPoly, bool)
General polynomial by private polynomial multiplication
Multiplies a NtruIntPoly by a NtruPrivPoly, i.e. a NtruTernPoly or a NtruProdPoly. The number of coefficients must be the same for both polynomials. It also returns if the number of coefficients differ or not.
fn mult_int(&self, b: &NtruIntPoly, mod_mask: u16) -> (NtruIntPoly, bool)
fn mult_int_16(&self, b: &NtruIntPoly, mod_mask: u16) -> (NtruIntPoly, bool)
fn mult_int_64(&self, b: &NtruIntPoly, mod_mask: u16) -> (NtruIntPoly, bool)
fn mult_fac(&mut self, factor: i16)
Multiply by factor
fn mod_center(&mut self, modulus: u16)
fn mod3(&mut self)
fn equals_mod(&self, other: &NtruIntPoly, modulus: u16) -> bool
Check if both polynomials are equals given a modulus
fn equals1(&self) -> bool
Trait Implementations
impl Default for NtruIntPoly
[src]
fn default() -> NtruIntPoly
Returns the "default value" for a type. Read more
impl Clone for NtruIntPoly
[src]
fn clone(&self) -> NtruIntPoly
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 Add for NtruIntPoly
[src]
type Output = NtruIntPoly
The resulting type after applying the +
operator
fn add(self, rhs: NtruIntPoly) -> Self::Output
The method for the +
operator
impl Sub for NtruIntPoly
[src]
type Output = NtruIntPoly
The resulting type after applying the -
operator
fn sub(self, rhs: NtruIntPoly) -> Self::Output
The method for the -
operator