Skip to main content

A Fully Homomorphic Encryption (FHE) library for bridging the gap between theory and practice with a focus on performance and accuracy

Project description

Welcome to Liberate.FHE!

Liberate.FHE is an open-source Fully Homomorphic Encryption (FHE) library for bridging the gap between theory and practice with a focus on performance and accuracy.

Liberate.FHE is designed to be user-friendly while delivering robust performance, high accuracy, and a comprehensive suite of convenient APIs for developing real-world privacy-preserving applications.

Liberate.FHE is a pure Python and CUDA implementation of FHE. So, Liberate.FHE supports multi-GPU operations natively.

The main idea behind the design decisions is that non-cryptographers can use the library; it should be easily hackable and integrated with more extensive software frameworks.

Additionally, several design decisions were made to maximize the usability of the developed software:

  • Make the number of dependencies minimal.
  • Make the software easily hackable.
  • Set the usage of multiple GPUs as the default.
  • Make the resulting library easily integrated with the pre-existing software, especially Artificial Intelligence ( AI) related ones.

Key Features

  • RNS-CKKS scheme is supported.
  • Python is natively supported.
  • Multiple GPU acceleration is supported.
  • Multiparty FHE is supported.

Quick Start

from liberate import fhe
from liberate.fhe import presets

# Generate CKKS engine with preset parameters
grade = "silver"  # logN=14
params = presets.params[grade]

engine = fhe.ckks_engine(**params, verbose=True)

# Generate Keys
sk = engine.create_secret_key()
pk = engine.create_public_key(sk)
evk = engine.create_evk(sk)

# Generate test data
m0 = engine.example(-1, 1)
m1 = engine.example(-10, 10)

# encode & encrypt data
ct0 = engine.encorypt(m0, pk)
ct1 = engine.encorypt(m1, pk, level=5)

# (a + b) * b - a
result = (m0 + m1) * m1 - m0
ct_add = engine.add(ct0, ct1)  # auto leveling
ct_mult = engine.mult(ct1, ct_add, evk)
ct_result = engine.sub(ct_mult, ct0)

# decrypt & decode data
result_decrypted = engine.decrode(ct_result, sk)

If you would like a detailed explanation, please refer to the official documentation.

How to Install

Clone this repository

git clone https://github.com/Desilo/liberate.git

Install dependencies

poetry install

Run Cuda build Script.

python setup.py install
# poetry run python setup.py install

Build a python package

poetry build

Install Liberate.FHE library

pip install .
# poetry run python -m pip install .

Documentation

Please refer to Liberate.FHE for detailed installation instructions, examples, and documentation.

Citing Liberate.FHE

@Misc{Liberate_FHE,
  title={{Liberate.FHE: A New FHE Library for Bridging the Gap between Theory and Practice with a Focus on Performance and Accuracy}},
  author={DESILO},
  year={2023},
  note={\url{https://github.com/Desilo/liberate-fhe}},
}

License

  • Liberate.FHE is available under the BSD 3-Clause Clear license. If you have any questions, please contact us at contact@desilo.ai.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

liberate_fhe-0.9.0-cp311-cp311-manylinux_2_35_x86_64.whl (13.8 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.35+ x86-64

liberate_fhe-0.9.0-cp310-cp310-manylinux_2_35_x86_64.whl (13.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.35+ x86-64

File details

Details for the file liberate_fhe-0.9.0-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for liberate_fhe-0.9.0-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 38dd86ea40e491712084438ceb8e48c3d925d0114dade6514274f835373eb207
MD5 20885fa0bb35b3326be5ee6a9ae18a74
BLAKE2b-256 2ac4b77ef22afee55a9c2161045c7d50a7822f9829d1d9b57b2aafbaa8417700

See more details on using hashes here.

File details

Details for the file liberate_fhe-0.9.0-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for liberate_fhe-0.9.0-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 aedf51ea3f8dcfa923db3bf8a158083acbea619531fe92f0b7e8377316356916
MD5 8eb2e8c9576e88401a50c55cd2f7b9ed
BLAKE2b-256 9acdf4c828ffd0f095d5ee610a06dbd954b89c1d603e8d58a17b94b1459fa7a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page