pub struct DefaultCoefficientSerde;Expand description
Default implementation for coefficient serialization
Implementations§
Source§impl DefaultCoefficientSerde
Optimized packing for common bit widths
impl DefaultCoefficientSerde
Optimized packing for common bit widths
Sourcepub fn pack_coeffs_into<M: Modulus>(
poly: &Polynomial<M>,
bits_per_coeff: usize,
packed: &mut [u8],
) -> Result<()>
pub fn pack_coeffs_into<M: Modulus>( poly: &Polynomial<M>, bits_per_coeff: usize, packed: &mut [u8], ) -> Result<()>
Pack directly into caller-owned exact-size storage.
Secret-key encoders use this form so no growable byte allocation ever temporarily owns encoded secret coefficients.
Sourcepub fn pack_10bit<M: Modulus>(poly: &Polynomial<M>) -> Result<Vec<u8>>
pub fn pack_10bit<M: Modulus>(poly: &Polynomial<M>) -> Result<Vec<u8>>
Optimized packing for 10-bit coefficients.
Sourcepub fn unpack_10bit<M: Modulus>(bytes: &[u8]) -> Result<Polynomial<M>>
pub fn unpack_10bit<M: Modulus>(bytes: &[u8]) -> Result<Polynomial<M>>
Optimized unpacking for 10-bit coefficients
Sourcepub fn pack_13bit<M: Modulus>(poly: &Polynomial<M>) -> Result<Vec<u8>>
pub fn pack_13bit<M: Modulus>(poly: &Polynomial<M>) -> Result<Vec<u8>>
Optimized packing for 13-bit coefficients (ML-DSA)
Trait Implementations§
Source§impl<M: Modulus> CoefficientPacker<M> for DefaultCoefficientSerde
impl<M: Modulus> CoefficientPacker<M> for DefaultCoefficientSerde
Source§fn pack_coeffs(poly: &Polynomial<M>, bits_per_coeff: usize) -> Result<Vec<u8>>
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
impl<M: Modulus> CoefficientUnpacker<M> for DefaultCoefficientSerde
Source§fn unpack_coeffs(bytes: &[u8], bits_per_coeff: usize) -> Result<Polynomial<M>>
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§
impl Freeze for DefaultCoefficientSerde
impl RefUnwindSafe for DefaultCoefficientSerde
impl Send for DefaultCoefficientSerde
impl Sync for DefaultCoefficientSerde
impl Unpin for DefaultCoefficientSerde
impl UnsafeUnpin for DefaultCoefficientSerde
impl UnwindSafe for DefaultCoefficientSerde
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more