Skip to main content

The DESILO Fully Homomorphic Encryption (FHE) library

Project description

The DESILO FHE Library

Welcome to the DESILO FHE library!

The DESILO FHE library is a homomorphic encryption library that is fast and intuitive. It delivers state-of-the-art performance, maximum accuracy, and versatile usability. Designed to be accessible and efficient for everyone, from beginners unfamiliar with homomorphic encryption to experts developing advanced algorithms.

Built on C++ and CUDA, the DESILO FHE library is optimized for both CPUs and NVIDIA GPUs. It includes a Python wrapper for easy use and seamless integration into existing AI workflows. Additionally, it supports CPU parallelization for environments without GPU access.

Currently, the DESILO FHE library supports real and complex number operations based on the RNS-CKKS scheme, with plans to expand to various integer-based schemes in the future. It provides a powerful solution adaptable to diverse environments and requirements.

Documentation

Please refer to the official documentation for detailed installation instructions, examples, and documentation.

Quickstart

Encrypt / Decrypt

Encryption and decryption can be done with a secret key. You can encrypt and decrypt data as shown below. Note that CKKS is a real-number-based scheme, so a very small error is introduced during encryption and decryption.

from desilofhe import Engine

engine = Engine()

secret_key = engine.create_secret_key()

data = [1, 2, 3]
encrypted = engine.encrypt(data, secret_key)
decrypted = engine.decrypt(encrypted, secret_key)

print(decrypted[:3]) # [1. 2. 3.]

Encryption can also be done with a public key, which is genereated from a secret key.

from desilofhe import Engine

engine = Engine()

secret_key = engine.create_secret_key()
public_key = engine.create_public_key(secret_key)

data = [1, 2, 3]
encrypted = engine.encrypt(data, public_key)
decrypted = engine.decrypt(encrypted, secret_key)

print(decrypted[:3]) # [1. 2. 3.]

Add / Subtract

To add or subtract ciphertext, no additional keys are required beyond the public and secret keys. You can encrypt data separately and then perform addition and subtraction as follows:

from desilofhe import Engine

engine = Engine()

secret_key = engine.create_secret_key()

data1 = [1, 2, 3]
encrypted1 = engine.encrypt(data1, secret_key)

data2 = [4, 5, 6]
encrypted2 = engine.encrypt(data2, secret_key)

added = engine.add(encrypted1, encrypted2)
subtracted = engine.subtract(encrypted1, encrypted2)

decrypted1 = engine.decrypt(added, secret_key)
decrypted2 = engine.decrypt(subtracted, secret_key)

print(decrypted1[:3], decrypted2[:3]) # [5. 7. 9.] [-3. -3. -3.]

Multiply

To multiply ciphertexts, a special key called the relinearization key is required due to the nature of homomorphic encryption. You can encrypt data and perform multiplication as shown below. Note that ciphertexts in homomorphic encryption have a maximum multiplication depth, which will decrease after multiplication.

from desilofhe import Engine

engine = Engine()

secret_key = engine.create_secret_key()
relinearization_key = engine.create_relinearization_key(secret_key)

data1 = [1, 2, 3]
encrypted1 = engine.encrypt(data1, secret_key)

data2 = [4, 5, 6]
encrypted2 = engine.encrypt(data2, secret_key)

multiplied = engine.multiply(encrypted1, encrypted2, relinearization_key)

decrypted = engine.decrypt(multiplied, secret_key)

print(decrypted[:3]) # [~4 ~10 ~18]
print(encrypted1.level, encrypted2.level, multiplied.level) # 7 7 6

Contact

If you have any questions, please contact us at library@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

If you're not sure about the file name format, learn more about wheel file names.

desilofhe_cu121-1.5.1-cp313-cp313-manylinux_2_34_x86_64.whl (999.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

desilofhe_cu121-1.5.1-cp312-cp312-manylinux_2_34_x86_64.whl (999.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

desilofhe_cu121-1.5.1-cp311-cp311-manylinux_2_34_x86_64.whl (1000.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

desilofhe_cu121-1.5.1-cp310-cp310-manylinux_2_34_x86_64.whl (998.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

desilofhe_cu121-1.5.1-cp39-cp39-manylinux_2_34_x86_64.whl (998.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

File details

Details for the file desilofhe_cu121-1.5.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for desilofhe_cu121-1.5.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a815d871f6d3ea4bcc7360b781d8fe9bf4d88b958a79f7fbe1a80d8b804ddaea
MD5 c5a182217612dc69d1f3b5bcb1295662
BLAKE2b-256 e5356df61f078544a1647e4f2208fb0ae6513c2eb6ca687f4b5b3b66bedb15ef

See more details on using hashes here.

File details

Details for the file desilofhe_cu121-1.5.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for desilofhe_cu121-1.5.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 16cd112e47f386835e975731238d5d5961ad3f72b1c44974834f87ac95c4924e
MD5 1fa8732afe93b8084563f1694e1d81e5
BLAKE2b-256 eae806a66028437431631eb14afa5dc54b5ac8aace6e94bb5ebeb82ec7a97329

See more details on using hashes here.

File details

Details for the file desilofhe_cu121-1.5.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for desilofhe_cu121-1.5.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7aa923264a08019bee092cc2035ffe8f766d8cf35b523d09adc76b867e0049f1
MD5 720c7e6cd97eeddb884067e4dc61bd62
BLAKE2b-256 3fdef5c73c986ff335b95dbebba63be0ccf3726613bc1efafe2d2ee97af8fa3b

See more details on using hashes here.

File details

Details for the file desilofhe_cu121-1.5.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for desilofhe_cu121-1.5.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3c2b65728d04d9fa227d2e4e9737ffecc8217a1e00ea06b2af6ddb43ec51d7ae
MD5 96f937af5497d741663ad7309af01cad
BLAKE2b-256 1fd5fc2ef873640ea2ecc2b45dd85c9527bdf114505ba263e0a21fb07a84b8b6

See more details on using hashes here.

File details

Details for the file desilofhe_cu121-1.5.1-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for desilofhe_cu121-1.5.1-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ff93d16c070667b833fd73ea687ab478719d685522b77116947ad62412346a9b
MD5 995fd6fcca0884c5e206a6a567e12dca
BLAKE2b-256 cc9296daf0b4efc37e336e4e1ce6b31c6a2c84f2a65949917010edddbec7c1f7

See more details on using hashes here.

Supported by

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