This repository contains an OpenFHE-based project that implements a computational device that handles power-of-two exact arithmetic, up to 256-bits.
The reference paper for this work is A flexible and polynomial framework for integer arithmetic in CKKS.
| ❗ Keep in mind! |
|---|
| This repo is still WIP, so feel free to report any issue! ^^ |
One of the key ideas behind this work is simplicity. It can indeed be used by simply installing a custom OpenFHE fork and by compiling the CMake project.
We require a custom fork of OpenFHE (that is updated to v1.5.0 and it includes the StC-first bootstrapping), this allows to use the two functions EvalChebyshevSeriesPSBatchRepeated and EvalBootstrapStCFirstBits. The first generalizes the functionality to evaluate a Chebyshev polynomial over a ciphertext to evaluate
- Install the
repeated_poly_and_stcbootbranch from this custom fork of OpenFHE
git clone --branch repeated_poly_and_stcboot --single-branch https://github.com/lorenzorovida/openfhe-development-chebyshevSIMD
cd openfhe-development-chebyshevSIMD
mkdir build
cmake ..
sudo make install
- Now, navigate to your desired folder and install this repository
git clone https://github.com/lorenzorovida/flexible-integer-arithmetic-ckks
cd flexible-integer-arithmetic-ckks
mkdir build
The CMakeLists.txt must point to the custom version of OpenFHE. Be sure to replace all the instances of /Users/myuser/openfhe-development-chebyshevSIMD/build in the CMakeLists.txt file to your custom build folder! After that, build the repository:
cmake ..
make
Important
The compilation will fail if you are using the original version of OpenFHE, use the fork!
- Finally, you can test if everything works by running
./FlexibleIntsCKKS --test
There are three parameters that can be passed to ./FlexibleIntsCKKS
--ring <size>
Sets the (logarithm of the) ring size. <size> must be an integer in (12, 13, 14, 15, 16).
Example:
./FlexibleIntsCKKS --ring 16
--bits <bits>
Sets the word size (number of bits per word). Only the following values are supported: 8, 16, 32, 64, 128, 256. If an unsupported value is provided, the program will display an error. Example:
./FlexibleIntsCKKS --bits 64
--verbose <value>
Sets the verbosity level of program output. <value> must be either 0, 1 or 2. Higher numbers mean more detailed output.
Example:
./FlexibleIntsCKKS --verbose 2
--input
Sets the program in input mode, i.e., the program will ask you to set the number of desired bits and to manually insert the values you want to compute operations on.
You can test 64-bits operation, in the
./FlexibleIntsCKKS --ring 12 --bits 64
This allows to test the code in a unsecure environment, useful if playing around with the code.
You can test 64-bits operation, in the
./FlexibleIntsCKKS --ring 16 --bits 64
You can use the program and manually insert some values to operate on
./FlexibleIntsCKKS --ring 12 --input
