1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Mathematical primitives for InsPIRe PIR.
//!
//! This module provides the core mathematical operations required for
//! lattice-based cryptography in the InsPIRe protocol:
//!
//! - **Modular arithmetic** over Z_q using Montgomery reduction
//! - **Number-Theoretic Transform (NTT)** for fast polynomial multiplication
//! - **Polynomial operations** over R_q = Z_q\[X\]/(X^d + 1)
//! - **Discrete Gaussian sampling** for error term generation
//!
//! # Overview
//!
//! The InsPIRe protocol operates over the polynomial ring R_q = Z_q\[X\]/(X^d + 1),
//! where d is typically 2048 or 4096 and q is an NTT-friendly prime (~2^60).
//! All cryptographic operations (encryption, key switching, homomorphic operations)
//! are built on these mathematical primitives.
//!
//! # Example
//!
//! ```
//! use inspire::math::{Poly, NttContext};
//!
//! // Create a polynomial and convert to NTT domain
//! let ctx = NttContext::with_default_q(256);
//! let mut poly = Poly::random(256, ctx.modulus());
//! poly.to_ntt(&ctx);
//! ```
pub use ;
pub use GaussianSampler;
pub use DEFAULT_Q;
pub use ModQ;
pub use NttContext;
pub use Poly;