| Crates.io | ghost-tfhe |
| lib.rs | ghost-tfhe |
| version | 0.1.0 |
| created_at | 2025-10-29 17:41:14.580268+00 |
| updated_at | 2025-10-29 17:41:14.580268+00 |
| description | TFHE (Torus Fully Homomorphic Encryption) implementation for computing on encrypted data |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1907024 |
| size | 46,902 |
A pure Rust implementation of TFHE (Torus Fully Homomorphic Encryption) for secure computation on encrypted data.
Add to your Cargo.toml:
[dependencies]
ghost-tfhe = "0.1.0"
use ghost_tfhe::tfhe::{TfheParams, TfheSecretKey, TfheEncoder};
fn main() {
// Generate parameters and keys
let params = TfheParams::default();
let secret_key = TfheSecretKey::generate(params);
// Encrypt boolean values
let encrypted_true = TfheEncoder::encode_bool(true, &secret_key);
let encrypted_false = TfheEncoder::encode_bool(false, &secret_key);
// Decrypt and verify
let decrypted_true = TfheEncoder::decode_bool(&encrypted_true, &secret_key);
let decrypted_false = TfheEncoder::decode_bool(&encrypted_false, &secret_key);
println!("true -> {}", decrypted_true);
println!("false -> {}", decrypted_false);
}
Run the basic demo:
cargo run --example basic_tfhe
torus.rs - Torus arithmetic operationsnoise.rs - Noise management for securityencoding.rs - Message encoding/decodinglwe.rs - LWE encryption primitivestlwe.rs - Torus LWE operationstgsw.rs - TGSW scheme for bootstrappingtfhe.rs - Main TFHE implementationoperations.rs - Homomorphic operationsThis implementation uses lattice-based cryptography with configurable noise parameters for quantum-resistant security.
MIT