Skip to content

VRAM-RAM/simple-crypto-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-crypto-lab


simple-crypto-lab Version License
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.

Warning

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.

Workspace structure

.
├── 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

Quick Start

Prerequisites

  • Rust 1.70+
  • Optional : Tyspt, if you want to edit / compile the documentation

Build the workspace

# 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 parallel

Documentation

You 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.

Build Documentation

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

What you'll learn

  • 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

Features

parallel : Enable multithreaded NTT and polynomial code with rayon. In fact, it can be less efficient than the single thread code...

Contributing

Contributions are welcome, especially :

  • Additional examples or tests
  • Bug reports
  • Corrections

License

The code is licensed under MIT or Apache-2.0, your choice.

Contact

Author & Developer : Olruix (VRAM-RAM)

About

Educational implementations of cryptographic schemes based on ring learning with errors (RLWE), in Rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages