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=15
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-fhe.git
cd liberate-fhe
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for liberate_fhe-0.2.0-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aad9c500ecbfa9fbfd3d0d2c7e3dc29653f734a4354e7a37d559bcd6f71664fc |
|
MD5 | 4065027301a6e52fd7627a562de116c1 |
|
BLAKE2b-256 | c9e519b4e0623909a4d34105791191fe1d29a4d95f68b5a155d03ac35fb2c06c |
Hashes for liberate_fhe-0.2.0-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b65169c788044ea10062a61b854677bef2b7128dccfc9907a2820319e266e80 |
|
MD5 | 0c793d6274f486a10b4a084fd2fa1e46 |
|
BLAKE2b-256 | b20dee81e9efb39474a9536530edf94e094f523268682f615a529fc9314b1168 |
Hashes for liberate_fhe-0.2.0-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0051133c0eaf55154506959549303dca9821e277671df696ccca6ff70f0d539b |
|
MD5 | bdc7720feaacd9c3c316eadde0fd1970 |
|
BLAKE2b-256 | 2d17e8106989edc8887eaeb078a5aab7ce3402e0e0fbdcc764dda7aaa7c7fe2e |
Hashes for liberate_fhe-0.2.0-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c046e43dba360597112fe09f8229beac26fa767182811f1d454bb9d02ba0109 |
|
MD5 | 8937d807db3171767d624d6d2446c966 |
|
BLAKE2b-256 | 0a90a7132be7a783cc77b9558f837a2986edcac2ab521f6e7f0120afa38b65fe |