Skip to main content

HEIR: Homomorphic Encryption Intermediate Representation

GitHub Workflow Status (with event) GitHub Contributors GitHub Discussions GitHub License OpenSSF Scorecard

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

There are currently three ways to use HEIR:

  • Use bazel and rules_heir with either the OpenFHE or Lattigo backends.
  • Install OpenFHE and use the heir_py Python package.
  • Install HEIR from source and invoke the heir-opt and heir-translate binaries directly, extracting the generated backend code and integrating it into your project manually.

See Getting Started for more details.

Building from source

This project uses bazel for its build system. Install bazelisk to manage the bazel version automatically. Then, with bazel on your path (pointing to bazelisk), run the following to build the main pass-running tool.

bazel build //tools:heir-opt

Or run an end-to-end test like

bazel test //tests/Examples/openfhe/ckks/halevi_shoup_matvec:all

HEIR depends on LLVM (from source) so a clean build may take 30 minutes depending on your machine. For faster builds, use BuildBuddy. Sign up for an account, create an API key, and add the following to .bazelrc.user in the root of the HEIR workspace:

common --remote_header=x-buildbuddy-api-key=<YOUR_API_KEY>
common --config=remote

This should reduce a clean build time to about 5 minutes.

See the bazel tips page for more example commands and tips on using bazel.

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:

Citations

The HEIR project can be cited in academic work through the following entry:

@misc{ali2025heir,
      title={HEIR: A Universal Compiler for Homomorphic Encryption},
      author={Asra Ali and Jaeho Choi and Bryant Gipson and Shruthi Gorantala
              and Jeremy Kun and Wouter Legiest and Lawrence Lim and Alexander
              Viand and Meron Zerihun Demissie and Hongren Zheng},
      year={2025},
      eprint={2508.11095},
      archivePrefix={arXiv},
      primaryClass={cs.CR},
      url={https://arxiv.org/abs/2508.11095},
}

Support disclaimer

This is not an officially supported Google product.

Metadata

Release files for heir-py 2026.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for heir-py 2026.12.1
File Size Uploaded Provenance Actions
heir_py-2026.12.1.tar.gz 15.8 MB With provenance Details for heir_py-2026.12.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for heir-py 2026.12.1
File Interpreter ABI Platform Actions
heir_py-2026.12.1-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for heir_py-2026.12.1-cp310-abi3-manylinux_2_28_x86_64.whl
heir_py-2026.12.1-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for heir_py-2026.12.1-cp310-abi3-manylinux_2_28_aarch64.whl
heir_py-2026.12.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for heir_py-2026.12.1-cp310-abi3-macosx_11_0_arm64.whl

Total release size: 126.2 MB

Release files / heir_py-2026.12.1.tar.gz

Download URL heir_py-2026.12.1.tar.gz
Size 15.8 MB
Tags Source
SHA-256 checksum
How to use checksums
3c8dfbd5ea965fdd3694daedd8dea75eb9c99160ec6021b9d109dd7920593e7b
BLAKE2b-256 checksum
How to use checksums
6390adb2233de6ff4efa636001f27bb192ff7cfe7182b46012431dd94a75c5a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / heir_py-2026.12.1-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL heir_py-2026.12.1-cp310-abi3-manylinux_2_28_x86_64.whl
Size 36.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0eec81efbd455bb1cbb72b3916a7df0555134960b8b9c06f2fc010f1f75952a1
BLAKE2b-256 checksum
How to use checksums
955c262fdecd33c5f2f082514115e2b93d8435b1a27d7d48c0e66c709a628abc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / heir_py-2026.12.1-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL heir_py-2026.12.1-cp310-abi3-manylinux_2_28_aarch64.whl
Size 34.1 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
cc46ce44a766f11b6d917c6d320df3c64b060b3e0072a55da9d20e0ac9b72604
BLAKE2b-256 checksum
How to use checksums
0d88049a92b4537ffa0e2d3dd049be53d974afb8ab4c6968dde8af5f747a16a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / heir_py-2026.12.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL heir_py-2026.12.1-cp310-abi3-macosx_11_0_arm64.whl
Size 40.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
9f44d4a7e193312afa37f2e9e7652de5b308d05fce3a981be2c52f15417479b2
BLAKE2b-256 checksum
How to use checksums
b8c675845b0c7fbd3747f9ca43501a01f3ee34dfe6f9c2d273c242ebef1e351d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for heir-py 2026.12.1

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.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for heir_py-2026.12.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page