This repo contatins a fully homomorphic implementation of AES-128 based on TFHE-rs. The design and implementation details can be found in Design and Implemetation.
- install the rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > sh.rustup.rs
bash sh.rustup.rs -y --default-toolchain nightly-2024-11-29
. "$HOME/.cargo/env"
- build the project
cargo build --release
Usage:
# `<key>` and `<iv>` are hexadecimal strings corresponding to 128-bit integers
cargo run --release -- --key <key> --iv <iv> --number-of-outputs <n>
Example:
# run the benchmark, takes about ~8 minutes on a vm with 192 vcpus of 4th gen AMD EPYC processors
cargo run --release -- --key 0x2b7e151628aed2a6abf7158809cf4f3c --iv 0xf0f1f2f3f4f5f6f7f8f9fafbfcfdfeff --number-of-outputs 192
The output looks like:
number-of-outputs: 192
key : "0x2b7e151628aed2a6abf7158809cf4f3c"
iv : "0xf0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
AES key expansion took: 11.502926454s
AES of #192 outputs computed in: 478.098018668s
AES test passed!