pub struct ToyLwe {
pub n: usize,
pub q: u64,
pub error_bound: u64,
}Expand description
Lattice-based encryption toy model.
Implements a toy version of LWE encryption for educational illustration. Uses very small parameters (NOT secure).
§WARNING
This is an educational toy. Parameters are not cryptographically secure.
Fields§
§n: usizeDimension n (key length)
q: u64Modulus q
error_bound: u64Error bound (max absolute value of noise)
Implementations§
Source§impl ToyLwe
impl ToyLwe
Sourcepub fn new(n: usize, q: u64, error_bound: u64) -> Self
pub fn new(n: usize, q: u64, error_bound: u64) -> Self
Create a new LWE context with given parameters.
Sourcepub fn inner_product(&self, a: &[u64], s: &[u64]) -> u64
pub fn inner_product(&self, a: &[u64], s: &[u64]) -> u64
Compute (a · s) mod q, the inner product of a and s.
Auto Trait Implementations§
impl Freeze for ToyLwe
impl RefUnwindSafe for ToyLwe
impl Send for ToyLwe
impl Sync for ToyLwe
impl Unpin for ToyLwe
impl UnsafeUnpin for ToyLwe
impl UnwindSafe for ToyLwe
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