The HEIR compiler
Project description
HEIR: Homomorphic Encryption Intermediate Representation
An MLIR-based toolchain for homomorphic encryption compilers. Read the docs at the HEIR website.
For more information on MLIR, see the MLIR homepage.
Quickstart (Python)
Pip install the heir_py package
pip install heir_py
Then run an example:
from heir import compile
from heir.mlir import F32, I16, I64, Secret
@compile() # defaults to scheme="bgv", OpenFHE backend, and debug=False
def func(x: Secret[I16], y: Secret[I16]):
sum = x + y
diff = x - y
mul = x * y
expression = sum * diff + mul
deadcode = expression * mul
return expression
foo.setup()
enc_a = foo.encrypt_a(7)
enc_b = foo.encrypt_b(8)
result_enc = foo.eval(enc_a, enc_b)
result = foo.decrypt_result(result_enc)
print(
f"Expected result for `func`: {func.original(7,8)}, FHE result:"
f" {result}"
)
This will compile the function above using the BGV scheme to machine code via
the OpenFHE backend.
Then calling the function will encrypt the inputs, run the function, and return
the decrypted result. The function call foo(7, 8) runs the entire
encrypt-run-decrypt flow for ease of testing.
Quickstart (heir-opt, heir-translate)
The python package heir_py ships with the heir-opt and heir-translate. If
you install via virtualenv, the binaries will be in your venv/bin.
venv/bin/heir-opt --help
Supported backends and schemes
| Backend Library | BGV | BFV | CKKS | CGGI |
|---|---|---|---|---|
| OpenFHE | ✅ | ✅ | ✅ | ❌ |
| Lattigo | ✅ | ✅ | ✅ | ❌ |
| tfhe-rs | ❌ | ❌ | ❌ | ✅ |
| Jaxite | ❌ | ❌ | ❌ | ✅ |
Note some backends do not support all schemes.
Contributing
There are many ways to contribute to HEIR:
- Come to our monthly meetings to discuss active work on HEIR and future project directions. The meetings are recorded and posted to our blog and YouTube channel.
- Come to our weekly office hours for informal discussions and debugging help.
- Ask questions or discuss feature ideas in the
#heirchannel on the FHE.org discord. - Work on an issue marked "good first issue" or browse issues labeled by topic.
- Help us understand new FHE research: either
- Read a paper tagged under research synthesis and summarize the novel techniques that could be ported to HEIR.
- File new issues under research synthesis to alert us of papers that should be investigated and incorporated into HEIR.
Citations
The HEIR project can be cited in in academic work through following entry:
@Misc{HEIR,
title={{HEIR: Homomorphic Encryption Intermediate Representation}},
author={HEIR Contributors},
year={2023},
note={\url{https://github.com/google/heir}},
}
Support disclaimer
This is not an officially supported Google product.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file heir_py-0.0.2.tar.gz.
File metadata
- Download URL: heir_py-0.0.2.tar.gz
- Upload date:
- Size: 47.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83157635c13cb19d5522e60d85827e8f9db2b8660a94cae6157a2dd3332acaf3
|
|
| MD5 |
1f2bcbe4bd732db62cf3872ddbc48536
|
|
| BLAKE2b-256 |
f904d356717149a223692cdb5c9cfc7b940a3ccc861090f4a52c42b667daa8b7
|
Provenance
The following attestation bundles were made for heir_py-0.0.2.tar.gz:
Publisher:
wheels.yml on google/heir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heir_py-0.0.2.tar.gz -
Subject digest:
83157635c13cb19d5522e60d85827e8f9db2b8660a94cae6157a2dd3332acaf3 - Sigstore transparency entry: 268902173
- Sigstore integration time:
-
Permalink:
google/heir@e44e2e418b68d26328dc3e30fb179484ee202c1c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/google
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@e44e2e418b68d26328dc3e30fb179484ee202c1c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file heir_py-0.0.2-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: heir_py-0.0.2-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 69.8 MB
- Tags: CPython 3.11+, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5d9f95edc958757387b60cb00859443decd2255bf4e54c985c30db8b7597a6e
|
|
| MD5 |
40e67fa0d252e097b2cfd05d5cf0c45e
|
|
| BLAKE2b-256 |
fa5f0b8adee41af84b50e347d7143defe74e94906bff51fd9485556558dac3ec
|
Provenance
The following attestation bundles were made for heir_py-0.0.2-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on google/heir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heir_py-0.0.2-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
f5d9f95edc958757387b60cb00859443decd2255bf4e54c985c30db8b7597a6e - Sigstore transparency entry: 268902182
- Sigstore integration time:
-
Permalink:
google/heir@e44e2e418b68d26328dc3e30fb179484ee202c1c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/google
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@e44e2e418b68d26328dc3e30fb179484ee202c1c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file heir_py-0.0.2-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: heir_py-0.0.2-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 62.5 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8787777211bc9bc6af17dd38af97e1628b9644a1ba484985f0d6ea22dd791992
|
|
| MD5 |
5b5f0518970f2d5f91aee4f5ec1b2146
|
|
| BLAKE2b-256 |
0176cfa50380a5cca861dc8ef7b6779ef550d4aa409e61d4b6469b8f3ed6fc24
|
Provenance
The following attestation bundles were made for heir_py-0.0.2-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
wheels.yml on google/heir
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heir_py-0.0.2-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
8787777211bc9bc6af17dd38af97e1628b9644a1ba484985f0d6ea22dd791992 - Sigstore transparency entry: 268902186
- Sigstore integration time:
-
Permalink:
google/heir@e44e2e418b68d26328dc3e30fb179484ee202c1c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/google
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@e44e2e418b68d26328dc3e30fb179484ee202c1c -
Trigger Event:
workflow_dispatch
-
Statement type: