This workspace contains educational implementations of cryptographic schemes based on
ring learning with errors (RLWE). The code is designed for learning and experimentation,
not for production use.
This lab is for educational and experimental purposes only.
It is not :
- Audited for security
- Constant-time
- Suitable for protecting sensitive datas
For production use, consider audited library, like :
If you need a Rust implementation, please see fhe.rs, but it isn't audited.
.
├── Cargo.toml
├── docs #The documentation
│ ├── simple-bfv.pdf
│ ├── simple-bfv.typ
│ ├── simple-ring.pdf
│ └── simple-ring.typ
├── LICENSE-APACHE #Licenses
├── LICENSE-MIT
├── README.md
├── schemes
│ ├── README.md #Local README for schemes
│ └── simple-bfv #BFV implementation (simple-bfv crate)
│ ├── Cargo.toml
│ ├── README.md
│ └── src
│ ├── config.rs
│ ├── find_parameters.rs
│ ├── lib.rs
│ ├── plaintext.rs
│ └── scheme.rs
└── simple-ring #simple-ring crate
├── Cargo.toml
├── README.md
└── src
├── lib.rs
├── modular.rs
├── ntt.rs
├── polys.rs
├── ring.rs
└── sampling.rs- Rust 1.70+
- Optional : Tyspt, if you want to edit / compile the documentation
# Build all crates :
cargo build --workspace -release
# Run all tests :
cargo test --workspace --release
# Run with parallel NTT & parallel polynomial code (requires rayon, and it's experimental) :
cargo build --workspace --release --features parallelYou can find the documentation either on docs.rs, but it's very minimalist, or in /docs/, where you can find the full documentation for each crate.
If you need to build it :
# Rust API documentation :
cargo doc --workspace --open
# Crates full documentation :
cd docs
typst compile simple-ring.typ
typst compile simple-bfv.typ- The Ring : how it works and why it's used
- NTT : Why Number Theoretic Transform is so efficient and how does it work
- BFV Scheme : Key generation, encryption, decryption, and homomorphic operations
- Noise Management : How noise grows and why it limits computation depth
- Coefficients sampling
parallel : Enable multithreaded NTT and polynomial code with rayon. In fact, it can be less efficient than the single thread code...
Contributions are welcome, especially :
- Additional examples or tests
- Bug reports
- Corrections
The code is licensed under MIT or Apache-2.0, your choice.
Author & Developer : Olruix (VRAM-RAM)