dcrypt_algorithms/lattice/mod.rs
1//! Lattice Cryptography Primitives
2//!
3//! This module serves as a convenient entry point for lattice-based cryptographic
4//! schemes, primarily re-exporting the generic polynomial algebra engine.
5//! It may later host lattice-specific constants or helper functions that
6//! are not general enough for the `poly` module but are shared among
7//! different lattice schemes (e.g., Ring-LWE, Module-LWE).
8
9#![cfg_attr(not(feature = "std"), no_std)]
10
11// Re-export all public items from the polynomial engine.
12// Implementations will typically use `algorithms::lattice::Polynomial` etc.
13pub use crate::poly::*;
14
15// Example of a lattice-specific helper that might be added later:
16//
17// /// Performs Barrett reduction for a specific power-of-two modulus,
18// /// often used in lattice cryptography for fast modular reduction.
19// pub fn barrett_reduce_pow2(value: u64, q: u32, k: u32, precomputed_r: u64) -> u32 {
20// // q must be a power of two, k = log2(q)
21// // precomputed_r = floor(2^(k+s) / q) where s is a shift parameter.
22// // This is a conceptual placeholder.
23// (value - (((value * precomputed_r) >> (k + s)) * q)) as u32
24// }