iliailia / comparison-circuit-over-fq

Homomorphic comparison in leveled homomorphic encryption and its applications
MIT License
36 stars 8 forks source link

Faster homomorphic comparison operations for BGV and BFV

This repository contains the LaTeX and C++ code of the homomorphic pattern matching algorithm from the paper "Faster homomorphic comparison operations for BGV and BFV" by Ilia Iliashenko and Vincent Zucca.

Installation guide

To build the code, install HElib (>= 2.0.0), go to the code folder and run

cmake .

and finally

make

How to use

Integer comparison

To test the basic comparison of integers, use the following command

./comparison_circuit circuit_type p d m q l runs print_debug_info

where

The following line performs 10 tests of our bivariate comparison circuit comparing vectors of length 3 over the finite field of order 49.

./comparison_circuit B 7 2 300 90 3 10 y

Sorting

The sorting algorithm can be executed by the following line

./sorting_circuit p d m q l N runs print_debug_info

where the most arguments are analogous to the comparison circuit above. The additional argument is

By default, the sorting algorithm uses the univariate circuit.

Minimum of an array

To test the minimum function, run this command

./min_max_circuit p d m q l N T runs print_debug_info

where

Other arguments have the same meaning as above. The univariate circuit is used here by default.