Parasol Runtime
This crate contains the Sunscreen Parasol runtime, which supports running programs over encrypted data with the Parasol processor. This crate provides key generation, encryption, and decryption functionality. Additionally, you can use the fluent module to directly compose and run TFHE circuit bootstrapping circuits:
use crate::{
fluent::{FheCircuitCtx, PackedUInt}, ComputeKey, Encryption, Evaluation, L1GgswCiphertext, L1GlweCiphertext, PublicKey, SecretKey, CircuitProcessor, DEFAULT_128
};
use std::sync::Arc;
fn multiply_16_bit() {
let sk = SecretKey::generate_with_default_params();
let ck = Arc::new(ComputeKey::generate_with_default_params(&sk));
let pk = PublicKey::generate(&DEFAULT_128, &sk);
let enc = Encryption::new(&DEFAULT_128);
let eval = Evaluation::new(ck, &DEFAULT_128, &enc);
let (mut proc, flow_control) = CircuitProcessor::new(16384, None, &eval, &enc);
let a = PackedUInt::<16, L1GlweCiphertext>::encrypt(42, &enc, &pk);
let b = PackedUInt::<16, L1GlweCiphertext>::encrypt(16, &enc, &pk);
let ctx = FheCircuitCtx::new();
let a = a
.graph_input(&ctx)
.unpack(&ctx)
.convert::<L1GgswCiphertext>(&ctx);
let b = b
.graph_input(&ctx)
.unpack(&ctx)
.convert::<L1GgswCiphertext>(&ctx);
let c = a
.mul::<L1GlweCiphertext>(&b, &ctx)
.pack(&ctx, &enc)
.collect_output(&ctx, &enc);
proc.run_graph_blocking(&ctx.circuit.borrow(), &flow_control);
assert_eq!(c.decrypt(&enc, &sk), 672);
}