Parasol processor
This crate contains Sunscreen's virtual processor, which allows users to run computations over encrypted data using FHE (Fully Homomorphic Encryption). Its out-of-order processor design automatically extracts parallelism from user-provided programs to run them efficiently on modern architectures. Additionally, its design provides more flexibility than the traditional circuits used in FHE.
Basic example
Let's build a basic program where an end user can encrypt two values and send them to a server which will compute and respond with their encrypted sum. After that, the user decrypts the result. For simplicity, we'll describe both parties in a single program.
Program that will run on our virtual processor:
add.c:
typedef unsigned char uint8_t;
uint8_t
Compile add.c
This Rust program that runs on the host generates keys, encrypts our data, runs our program, and decrypts the result:
main.rs
use ;
use ;
// Embed the compiled Parasol add program into a constant.
const FHE_FILE: & = include_bytes!;
And finally, our Cargo.toml
[]
= "hello-world"
= "0.1.0"
= "2024"
[]
= "0.10"
= "0.10"
When we run our program
cargo run --release
we get
Encrypted 2 + 7 = 9