Struct DefaultCoefficientSerde

Source
pub struct DefaultCoefficientSerde;
Expand description

Default implementation for coefficient serialization

Implementations§

Source§

impl DefaultCoefficientSerde

Optimized packing for common bit widths

Source

pub fn pack_10bit<M: Modulus>(poly: &Polynomial<M>) -> Result<Vec<u8>>

Optimized packing for 10-bit coefficients (Kyber ciphertext)

Source

pub fn unpack_10bit<M: Modulus>(bytes: &[u8]) -> Result<Polynomial<M>>

Optimized unpacking for 10-bit coefficients

Source

pub fn pack_13bit<M: Modulus>(poly: &Polynomial<M>) -> Result<Vec<u8>>

Optimized packing for 13-bit coefficients (Dilithium)

Trait Implementations§

Source§

impl<M: Modulus> CoefficientPacker<M> for DefaultCoefficientSerde

Source§

fn pack_coeffs(poly: &Polynomial<M>, bits_per_coeff: usize) -> Result<Vec<u8>>

Packs the polynomial’s coefficients into a byte vector
Source§

impl<M: Modulus> CoefficientUnpacker<M> for DefaultCoefficientSerde

Source§

fn unpack_coeffs(bytes: &[u8], bits_per_coeff: usize) -> Result<Polynomial<M>>

Unpacks coefficients from a byte vector into a new polynomial

Auto Trait Implementations§

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> 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, 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