Skip to main content

Poly

Struct Poly 

Source
pub struct Poly<T: Field, const N: usize>(/* private fields */);

Implementations§

Source§

impl Poly<DilithiumFq, DILITHIUM_N>

Source

pub fn new_random<R: RngCore + CryptoRng>(rng: &mut R) -> Self

Source

pub fn into_array(self) -> [<<Self as Polynomial>::F as Field>::E; 256]

Source§

impl Poly<KyberFq, { KYBER_N / 2 }>

Source

pub fn serialize(&self, bytes: &mut [u8; 384])

Source

pub fn deserialize(&mut self, bytes: &[u8])

Source

pub fn cbd2(&mut self, buf: &[u8; 128])

Source

pub fn cbd3(&mut self, buf: &[u8; 192])

Source

pub fn getnoise_eta1<const K: usize>( &mut self, prf: &mut Prf, seed: &[u8; 32], nonce: u8, )

Source

pub fn getnoise_eta2(&mut self, prf: &mut Prf, seed: &[u8; 32], nonce: u8)

Source

pub fn ntt_and_reduce(&mut self)

Source

pub fn into_array(self) -> [<KyberFq as Field>::E; 256]

Source

pub fn compress_slice<const D: usize>(&self, ct: &mut [u8])

Source

pub fn decompress_slice<const D: usize>(&mut self, ct: &[u8])

Source

pub fn compress<const D: usize>(&self, ct: &mut [[u8; D]; 32])

Source

pub fn decompress<const D: usize>(&mut self, ct: &[[u8; D]; 32])

Source

pub fn set_from_message(&mut self, msg: &[u8; 32])

Source

pub fn from_message(msg: &[u8; 32]) -> Self

Source

pub fn compress_to_message(&self, msg: &mut [u8; 32])

Source

pub fn scale_mont(&mut self)

Inplace conversion of all coefficients of a polynomial from normal domain to Montgomery domain

§Arguments
  • r - Input/output polynomial

Trait Implementations§

Source§

impl<T: Field, const N: usize> AddAssign<&Poly<T, N>> for Poly<T, N>

Adds rhs polynomial to self; no modular reduction is performed.

§Arguments

  • rhs - Righthand-side input polynomial
Source§

fn add_assign(&mut self, rhs: &Self)

Performs the += operation. Read more
Source§

impl<F: Field, const N: usize> AsMut<[F; N]> for Poly<F, N>

Source§

fn as_mut(&mut self) -> &mut [F; N]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<F: Field, const N: usize> AsRef<[F; N]> for Poly<F, N>

Source§

fn as_ref(&self) -> &[F; N]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone + Field, const N: usize> Clone for Poly<T, N>

Source§

fn clone(&self) -> Poly<T, N>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Field, const N: usize> Debug for Poly<T, N>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Field, const N: usize> Default for Poly<T, N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Field, const N: usize> Index<usize> for Poly<T, N>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Field, const N: usize> IndexMut<usize> for Poly<T, N>

Source§

fn index_mut(&mut self, i: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, F: Field, const N: usize> IntoIterator for &'a Poly<F, N>

Source§

type Item = &'a F

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, F>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Iter<'a, F>

Creates an iterator from a value. Read more
Source§

impl<'a, F: Field, const N: usize> IntoIterator for &'a mut Poly<F, N>

Source§

type Item = &'a mut F

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, F>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> IterMut<'a, F>

Creates an iterator from a value. Read more
Source§

impl<T: PartialEq + Field, const N: usize> PartialEq for Poly<T, N>

Source§

fn eq(&self, other: &Poly<T, N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Field, const N: usize> SubAssign<&Poly<T, N>> for Poly<T, N>

Subtracts rhs polynomial from self, i.e. self <- self - rhs ; no modular reduction is performed.

§Arguments

  • rhs - Righthand-side input polynomial
Source§

fn sub_assign(&mut self, rhs: &Self)

Performs the -= operation. Read more
Source§

impl<T: Copy + Field, const N: usize> Copy for Poly<T, N>

Source§

impl<T: Field, const N: usize> StructuralPartialEq for Poly<T, N>

Auto Trait Implementations§

§

impl<T, const N: usize> Freeze for Poly<T, N>
where T: Freeze,

§

impl<T, const N: usize> RefUnwindSafe for Poly<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: usize> Send for Poly<T, N>
where T: Send,

§

impl<T, const N: usize> Sync for Poly<T, N>
where T: Sync,

§

impl<T, const N: usize> Unpin for Poly<T, N>
where T: Unpin,

§

impl<T, const N: usize> UnsafeUnpin for Poly<T, N>
where T: UnsafeUnpin,

§

impl<T, const N: usize> UnwindSafe for Poly<T, N>
where T: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V