Table of Contents
Homomorphic Encryption (HE) is increasing in popularity amongst the encryption and data security community. However, most libraries are currently implemented in C++, which prevents HE from fully becoming mainstream. Recently, a few Python libraries for HE have been developed, which should reduce the obstacles of using an encryption technique as complex as HE. This paper illustrates basic use cases of these Python libraries by implementing a tool that benchmarks their performance in order to contribute to further disseminating HE. The results of an exemplary benchmarking study show that two Python HE libraries, namely Pyfhel and TenSEAL, clearly outperform another Python HE library named Palisade in any kind of operations and should therefore be preferred if performance is an issue. Even though this paper illustrates that HE libraries are improving in easiness of usability, HE should not be thought of as a means to solve all data privacy issues once and for all, as its potential also comes hand in hand with a risk of increasing recklessness with regards to the analysis of personal data.
To be able to run benchmark the dependencies should be installed before the requirements.txt
- Install Pyfhel repo
- Install TenSeal repo
- Install PALISADE HOMOMORPHIC ENCRYPTION SOFTWARE LIBRARY repo
- Goto CLI folder
git clone https://github.com/differentiator/he_benchmark cd he_benchmark/he_benchmarking
- Specify parameters for desired Homomorphic encryption configuration in the implementation
- Specify implementation classes to use with -c parameter
- Specify number of runs per operation to use with -n parameter
- Specify how verbosity -v true/yes or false/no to show extra info
- Specify output directory for the generated results file
- Example command
python main.py -n 1000 -c PyfhelHE -c TenSealHE -c PalisideHE -v true -o OUTPUT_DIR
Project can be used via command line interface with following parameters
usage: main.py [-h] [-n NUMBER_OF_RUNS] [-c CLASS_NAME [CLASS_NAME ...]]
[-o OUTPUT_FOLDER] [-v VERBOSE]
options:
-h, --help show this help message and exit
-n NUMBER_OF_RUNS, --number_of_runs NUMBER_OF_RUNS
Number of runs per operation
-c CLASS_NAME [CLASS_NAME ...], --class_name CLASS_NAME [CLASS_NAME ...]
Class name of implemented backends, can be multiple
-o OUTPUT_FOLDER, --output_folder OUTPUT_FOLDER
Output folder to save results
-v VERBOSE, --verbose VERBOSE
Verbosity for logging
Process finished with exit code 0
Example usage:
python main.py -n 1000 -c PyfhelHE -c TenSealHE -c PalisideHE -v true -o OUTPUT_DIR
This will generate detailed log and output as JSON in output folder
In case of not specifying output directory or verbose true aggregated results will be written to the console
Results could be aggregated with different tools, such as R, for example, could be used for the distribution visualization:
- CLI arguments parsing
- Data generation
- File output for results (JSON)
- Logging
- Extensible codebase
- Easy to integrate new HE library into benchmark
- Multiple Homomorphic Encryption frameworks supported
- Palisade
- Pyfhel
- TenSeal
- Any other framework
Distributed under the MIT License. See LICENSE.txt
for more information.