This project has been archived by its maintainers, and is no longer receiving any updates.
__ __________________ __ ________ ______ _ __
/ / / / ____/ ____/ __ \ _ / / / / ____/ / ____/___ ____ ___ ____ (_) /__ _____
/ /_/ / __/ / / / / / / (_) / /_/ / __/ / / / __ \/ __ `__ \/ __ \/ / / _ \/ ___/
/ __ / /___/ /___/ /_/ / _ / __ / /___ / /___/ /_/ / / / / / / /_/ / / / __/ /
/_/ /_/_____/\____/\____/ (_) /_/ /_/_____/ \____/\____/_/ /_/ /_/ .___/_/_/\___/_/
/_/
HECO is an optimizing compiler for Fully Homomorphic Encryption (FHE). FHE allows computation over encrypted data, but imposes a variety of cryptographic and engineering challenges. This compiler translates high-level program descriptions (expressed in Python) into the circuit-based programming paradigm of FHE. It does so while automating as many aspects of the development as possible, including automatically identifying and exploiting opportunities to use the powerful SIMD parallelism ("batching") present in many schemes.
HECO Python Frontend
Note HECO's Python Frontend is still undergoing a major revision. The current version only prints a (almost MLIR) version of the code. We are working on extending the frontend with more functionality and completing the toolchain, such that frontend programs can be executed again.
Finalize Installation
The HECO frontend relies on a development version of xdsl. If you install HECO from PyPi, you need to install the xdsl dependency afterwards with:
python3 -m pip install git+https://github.com/xdslproject/xdsl.git@frontend
Examples
Examples of HECO can be found in the examples folder.
One of them, for computing the hamming distance of two encrypted vectors, is shown here:
from xdsl.frontend import *
from xdsl.frontend.dialects.builtin import *
from heco.frontend.dialects.fhe import *
p = FrontendProgram()
secret_f64 = SecretType[f64]
arg_type = BatchedSecretType[f64]
with CodeContext(p):
def encryptedHammingDistance(x: arg_type,
y: arg_type) -> secret_f64:
sum: SecretType[f64] = SecretAttr(FloatAttr(0.0))
for idx in range(0, 4):
sum = sum + (x[idx] - y[idx]) * (x[idx] - y[idx])
return sum
# XXX: the part below was not yet ported to the new frontend
# Compiling FHE code
context = SEAL.BGV.new(poly_mod_degree = 1024)
f = p.compile(context = context)
# Running FHF code
x = [random.randrange(100) for _ in range(4)]
y = [random.randrange(100) for _ in range(4)]
x_enc = context.encrypt(x)
y_enc = context.encrypt(y)
s_enc = f(x_enc, y_enc)
# Verifying Result
s = context.decrypt(s_enc)
assert s == sum([(x[i] - y[i])**2 for i in range(4)])
Metadata
Release files for heco 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| heco-0.0.2.tar.gz | 10.5 kB | Without provenance | Details for heco-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| heco-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for heco-0.0.2-py3-none-any.whl |
Total release size: 20.3 kB
Release files / heco-0.0.2.tar.gz
| Download URL | heco-0.0.2.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3278dd207d048e7bd88dabe6bf9c6ae86328d6ddf468bc6d3da30f4b1fbcf4d8
|
|
BLAKE2b-256 checksum How to use checksums |
80d1efeba2e595b6b1d39d2422cfd9433a2790ac1b13a5680fdb061287d393ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / heco-0.0.2-py3-none-any.whl
| Download URL | heco-0.0.2-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec685950f3689aa892b1dad8ce834316f1f2d395e68dda20a452c73e269a1bc2
|
|
BLAKE2b-256 checksum How to use checksums |
563833429023cce17ad8ef137ec3be15022decdc59a41868cf79fcf378549da5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for heco 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.