How to install TFHE homomorphic encryption & run the tutorial

published Aug 06, 2017 02:15   by admin ( last modified Aug 08, 2017 11:28 )

How to install the TFHE Fast Fully Homomorphic Encryption over the Torus library and run its tutorial on Linux.

Make sure you have the dependencies, for ubuntu it is:

sudo apt-get install build-essential cmake

Download the tfhe source tarball, extract it and enter the top directory

mkdir build
cd build

Change "/home/jorgen/usr/local" to where you want your local install below:

cmake ../src -DCMAKE_INSTALL_PREFIX=/home/jorgen/usr/local
make
make install

Download the example files from

https://tfhe.github.io/tfhe/assets/data/samples.tar.gz

Make sure you have correct paths by making a script called "initialize.sh" with the following content:

#configure environment variables
TFHE_PREFIX=/home/jorgen/usr/local #the prefix where you installed tfhe
export LIBRARY_PATH=$LIBRARY_PATH:$TFHE_PREFIX/lib
export C_INCLUDE_PATH=$C_INCLUDE_PATH:$TFHE_PREFIX/include
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$TFHE_PREFIX/include

Run it from the terminal you are in with:

. initialize.sh

Enter the directory where the tutorial files are

Make a shell script called "run.sh" with the following contents:

g++ -o alice alice.c -ltfhe-spqlios-fma
g++ -o cloud cloud.c -ltfhe-spqlios-fma
g++ -o verif verif.c -ltfhe-spqlios-fma

chmod 755 alice
chmod 755 cloud
chmod 755 verif

./alice
./cloud
./verif

Run it

. run.sh