bit-ml / he-scheme

A Toy Implementation in Python of [FV12]
20 stars 7 forks source link

We implemented in Python a basic homomorphic encryption scheme inspired from [FV12].

Motivation

The starting point of our implementation is this github gist. The motivation behind our code was for us to understand in detail the two techniques of [FV12] used for ciphertext multiplication, namely relinearization and modulus-switching. This essential operation of ciphertext multiplication was missing in the previous implementation. We thought we might share this understanding through a blog post as well since it may be of interest to anyone using the [FV12] scheme in TenSeal or Seal libraries.

Disclaimer

Our toy implementation is not meant to be secure or optimized for efficiency. We did it to better understand the inner workings of the [FV12] scheme, so you can use it as a learning tool.

How to run

The rlwe_he_scheme_updated.py file contains the algorithms of the HE scheme. You can run main.py to play with computing on encrypted data. Have fun! :smile: