Sign inSign up

mazzonef/openfhe-statistics

By mazzonef

•Updated over 1 year ago

Ranking, Order Statistics, and Sorting under CKKS, using OpenFHE.

Image
Security
Data science
0

379

mazzonef/openfhe-statistics repository overview

⁠Ranking, Order Statistics, and Sorting under CKKS

This repository provides a library for performing ranking, order statistics, and sorting operations using the CKKS (Cheon-Kim-Kim-Song) homomorphic encryption scheme. Our code is built on top of the OpenFHE library.

⁠Docker Image Setup

Pull the docker image with:

docker pull mazzonef/openfhe-statistics

and run it with

docker run -it mazzonef/openfhe-statistics

⁠Benchmarking and Functionality Tests

The executables (ranking, minimum, median, and sorting) can be used to benchmark the runtime of the library under various configurations. These executables generate random input vectors, set up the CKKS encryption scheme, and perform the respective operations. By default, the CKKS parameters and approximation degrees are selected automatically, but you may modify them to optimize performance for specific scenarios.

⁠Usage

Each executable accepts specific arguments as follows:

⁠RANKING
./build/ranking <vector_length> [<tie_correction>] [<single_thread>]
  • vector_length: Length of the input vector (a power of two).
  • tie_correction: (Optional) Set to 1 to enable tie correction or 0 to disable it (default: 0).
  • single_thread: (Optional) Set to 1 to run in single-threaded mode or 0 to use multi-threading (default: 0).

Example:

./build/ranking 32 0 1
⁠MINIMUM
./build/minimum <vector_length> [<single_thread>]
  • vector_length: Length of the input vector (a power of two).
  • single_thread: (Optional) Set to 1 to run in single-threaded mode or 0 to use multi-threading (default: 0).

Example:

./build/minimum 32 1
⁠MEDIAN
./build/median <vector_length> [<single_thread>]
  • vector_length: Length of the input vector (a power of two).
  • single_thread: (Optional) Set to 1 to run in single-threaded mode or 0 to use multi-threading (default: 0).

Example:

./build/median 32 0
⁠SORTING
./build/sorting <vector_length> [<single_thread>]
  • vector_length: Length of the input vector (a power of two).
  • single_thread: (Optional) Set to 1 to run in single-threaded mode or 0 to use multi-threading (default: 0).

Example:

./build/sorting 32 1
⁠Automatic Benchmarking

We also provide a shell script benchmark.sh, which automatically benchmarks a given functionality for vector length going from 8 to 16384, in both single-threaded and multi-threaded setting. The runtime and memory consumption are stored in a csv file benchmark.out, while the log files are stored in the folder logs.

sh ./benchmark.sh <algorithm>
  • algorithm: One of the following: ranking, ranking-tie, minimum, median, sorting.

For additional information, please refer to the readme file at /app/README.md.

Tag summary

Content type

Image

Digest

sha256:7e8d3c862…

Size

210 MB

Last updated

over 1 year ago

docker pull mazzonef/openfhe-statistics