plat-core
Lattice cryptography primitives for Fully Homomorphic Encryption in pure Rust.
Part of the hyde ecosystem.
What's inside
| Module | What it does |
|---|---|
poly |
Polynomial ring Z_q[X]/(X^N + 1) — add, sub, negacyclic multiply |
ntt |
Number Theoretic Transform — O(N log N) polynomial multiplication |
modular |
Modular arithmetic — add, sub, mul, pow, inv over Z_q |
sampling |
Discrete Gaussian, uniform, ternary, binary sampling |
params |
Parameter sets (test, research-grade N=2048) |
rlwe |
Ring-LWE encryption — keygen, encrypt, decrypt, homomorphic add, scalar multiply |
Usage
use Params;
use NttTables;
use rlwe;
use SeedableRng;
use StdRng;
let params = test_small;
let ntt = new;
let mut rng = seed_from_u64;
// Key generation
let = keygen;
// Encrypt two values
let ct_a = encrypt_u64;
let ct_b = encrypt_u64;
// Homomorphic addition (no decryption!)
let ct_sum = add;
// Decrypt the result
let result = decrypt_u64;
assert_eq!;
Design
- Pure Rust — no C/C++ bindings, no FFI
- MIT license — no copyleft restrictions
- NTT uses the negacyclic twist for correct multiplication in Z_q[X]/(X^N + 1)
- Gaussian sampling via Box-Muller (rand_distr)
- All arithmetic uses u128 intermediates to avoid overflow
Parameters
| Name | N | q | σ | Security | Use |
|---|---|---|---|---|---|
test_tiny |
64 | 769 | 1.0 | — | Unit tests |
test_small |
256 | 12289 | 1.0 | — | Fast integration tests |
research_2048 |
2048 | 132120577 | 3.2 | ~100-bit | Research prototype |
Ecosystem
| Crate | Role |
|---|---|
| plat-core | Lattice primitives (this crate) |
| plat-mkfhe | Multi-Key FHE — compute across independent keys |
| hyde-plat | Unified re-export of the full stack |
License
MIT