TFHEpp is full Scracthed pure C++ Ver. of TFHE. TFHEpp is slightly(about 10%) faster than original TFHE implementation. In addition to that, THFEpp supports Circuit Bootstrapping and Private Boootstrapping many LUT. TFHEpp depends on AVX2 because we use SPQLIOS FMA. If you want run TFHEpp without AVX2, see spqlios++ branch. It include pure C++ implementation of SPQLIOS as header only library, but slow.
This code includes utf-8 identifiers like alpha. Therefore, Clang and GCC10 or later are primarily supported compilers. GCC9 is not supported.
The default parameter is 128 bit security. Please add -DUSE_80BIT_SECURITY=ON to use faster but less secure parameter.
Codes under thirdparties directory contain third-party libraries, Randen, Cereal, and SPQLIOS. See the corresponding directory to check the licenses.
TFHEpp uses this as a Cryptographically Secure Pseudo-Random Number Generator (CSPRNG). Original repository is here. I just removed some unnecessary codes, no modification.
cereal is a header-only C++11 serialization library. TFHEpp uses this to export ciphertexts and keys. Cereal is treated by git submodule.
SPQLIOS is the FFT library that is dedicated to the ring R[X]/(X^N+1) for N a power of 2. These codes come from experimental-tfhe. We just renamed instances to adapt with our codes.
Following Code measure how many time homomorphic NAND takes on your computer with TFHEpp.
git clone https://github.com/virtualsecureplatform/TFHEpp
cd TFHEpp
mkdir build
cd build
cmake .. -DENABLE_TEST=ON
make
./test/nand
If you want to run semantically equivalent test on original TFHE, run below code.
git clone https://github.com/tfhe/tfhe.git --recursive
cd tfhe
mkdir build
cd build
cmake ../src -DENABLE_TESTS=on -DENABLE_NAYUKI_PORTABLE=off -DENABLE_NAYUKI_AVX=off -DENABLE_SPQLIOS_AVX=off -DENABLE_SPQLIOS_FMA=on -DCMAKE_BUILD_TYPE=optim
make
./test/test-gate-bootstrapping-spqlios-fma
If you have Docker on your system, this will do above on docker.
git clone https://github.com/virtualsecureplatform/TFHEpp
cd TFHEpp
docker build -t tfheppbench .
This is for TFHE-10ms. Because TFHE-10ms only supports 80-bit security parameter, this is not included in Dockerfile
git clone https://github.com/virtualsecureplatform/tfhe-10ms.git --recursive
cd tfhe-10ms
mkdir build
cd build
cmake ../src -DENABLE_TESTS=on -DENABLE_NAYUKI_PORTABLE=off -DENABLE_NAYUKI_AVX=off -DENABLE_SPQLIOS_AVX=off -DENABLE_SPQLIOS_FMA=on -DCMAKE_BUILD_TYPE=optim
make
./test/test-bootstrapping-fft-spqlios-fma
Here is the slides (in japanese). https://nindanaoto.github.io/
For the people who want to cite this library directly (may be in addition to VSP paper), I give a below example of bibtex citation.
@misc{TFHEpp,
author = {Kotaro Matsuoka},
title = {{TFHEpp: pure C++ implementation of TFHE cryptosystem}},
year = {2020},
howpublished = {\url{https://github.com/virtualsecureplatform/TFHEpp}}
}