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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! InsPIRe PIR Protocol Implementation
//!
//! This module implements the InsPIRe PIR (Private Information Retrieval) protocol
//! using RGSW encryption and homomorphic polynomial rotation.
//!
//! # Protocol Overview
//!
//! 1. **Setup**: Encode database as polynomials, generate CRS and secret key
//! 2. **Query**: Client sends RGSW ciphertext encoding the inverse monomial X^(-k)
//! 3. **Respond**: Server performs homomorphic rotation to move target to coefficient 0
//! 4. **Extract**: Client decrypts RLWE response and reads coefficient 0
//!
//! # Key Features
//!
//! - Direct coefficient encoding with RGSW monomial rotation
//! - Only 2 key-switching matrices (InspiRING)
//! - CRS model for server-side preprocessing
//!
//! # Example
//!
//! ```ignore
//! use inspire::pir::{setup, query, respond, extract};
//! use inspire::params::InspireParams;
//! use inspire::math::GaussianSampler;
//!
//! let params = InspireParams::default();
//! let database = vec![0u8; 1024 * 32]; // 1024 entries of 32 bytes each
//! let entry_size = 32;
//! let mut sampler = GaussianSampler::new(params.sigma);
//!
//! // Server setup (returns CRS, encoded DB, and secret key)
//! let (crs, encoded_db, rlwe_sk) = setup(¶ms, &database, entry_size, &mut sampler)?;
//!
//! // Client query (requires secret key)
//! let target_index = 42u64;
//! let (state, query) = query(&crs, target_index, &encoded_db.config, &rlwe_sk, &mut sampler)?;
//!
//! // Server response
//! let response = respond(&crs, &encoded_db, &query)?;
//!
//! // Client extraction
//! let entry = extract(&crs, &state, &response, entry_size)?;
//! ```
pub use Result;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;