/he_benchmark

Homomorphic Encryption Benchmarking CLI

MIT LicenseMIT


Logo

Homomorphic Encryption CLI

Universal and extensible benchmarking utility for homomorphic encryption libraries in Python

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Example results
  5. Roadmap
  6. License

About The Project

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.

(back to top)

Built With

(back to top)

Getting Started

To be able to run benchmark the dependencies should be installed before the requirements.txt

Installation

  1. Install Pyfhel repo
  2. Install TenSeal repo
  3. Install PALISADE HOMOMORPHIC ENCRYPTION SOFTWARE LIBRARY repo
  4. Goto CLI folder
    git clone https://github.com/differentiator/he_benchmark
    cd he_benchmark/he_benchmarking
  5. Specify parameters for desired Homomorphic encryption configuration in the implementation
  6. Specify implementation classes to use with -c parameter
  7. Specify number of runs per operation to use with -n parameter
  8. Specify how verbosity -v true/yes or false/no to show extra info
  9. Specify output directory for the generated results file
  10. Example command
    python main.py -n 1000 -c PyfhelHE -c TenSealHE -c PalisideHE -v true -o OUTPUT_DIR

(back to top)

Usage

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

(back to top)

Example results

(back to top)

In case of not specifying output directory or verbose true aggregated results will be written to the console

Verbose1

Verbose2

Results could be aggregated with different tools, such as R, for example, could be used for the distribution visualization:

Plot1

Plot2

Roadmap

  • 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

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)