Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

HEU

CircleCI PyPI version

中文

HEU (Homomorphic Encryption processing Unit) is a user-friendly and high-performance homomorphic encryption library that supports multiple types and scalable hardware acceleration.

document

https://www.secretflow.org.cn/docs/heu/

Repo status

Homomorphic encryption algorithms are mainly divided into two categories: partially homomorphic encryption (PHE) and fully homomorphic encryption (FHE). Currently, HEU supports most PHE algorithms, while FHE is still under development and will take some time.

Supported algorithms:

  • Additive homomorphic encryption
    • Paillier (recommended)
    • Okamoto–Uchiyama (recommended)
    • EC ElGamal
    • Damgard-Jurik
    • Damgard-Geisler-Krøigaard (DGK)
  • Fully homomorphic encryption
    • Under development and is the current focus of work.

Each algorithm includes a variety of different implementations, and some implementations support hardware accelerators. For more details, please refer to the Document

Layout

.
├── .circleci  # CI/CD configuration files for circleci
├── .github    # Configuration files for GitHub
├── docs       # HEU documentation in Sphinx format
├── heu        # All the implementation code for HEU
│   ├── algorithms     # Holds the implementations of all algorithms
│   ├── experimental   # Contains some standalone experimental code
│   ├── library        # Implements the application layer functionality of the HE Library
│   │   ├── algorithms # Legacy algorithms not yet migrated to SPI (this directory will be deprecated after migration)
│   │   ├── benchmark  # Contains benchmarking code
│   │   ├── numpy      # Implements a set of Numpy-like interfaces
│   │   └── phe        # PHE Dispatcher implementation (to be deprecated, with replaced by SPI)
│   ├── pylib          # Python bindings
│   └── spi            # Defines the HEU software and hardware access layer interface (SPI)
│       ├── he         # Contains HE SPI and related Sketches
│       └── poly       # Defines polynomial interfaces and related Sketches
└── third_party        # Contains third-party libraries required for compilation; libraries will be automatically downloaded during build

HEU is currently transitioning from the old Dispatcher architecture to an SPI-based framework. The main modules and their code path mappings for both architectures are as follows:

Dispatcher-based architecture:

     Python APIs (Python binding)
          PATH: heu/pylib
                  │
                  ├───────────────────┐
                  │                   ▼
                  │    Tensor Lib with Numpy-like API
                  │        PATH: heu/library/numpy
                  │                   │
                  │     ┌─────────────┘
                  │     │
                  ▼     ▼
     PHE Dispatcher & PHE C++ API
        PATH: heu/library/phe
                  │
                  │
                  ▼
 Various PHE algorithm implementations
     PATH: heu/library/algorithms

SPI-based architecture:

    Python APIs (Python binding)
         PATH: heu/pylib
                 │
                 ├───────────────────┐
                 │                   ▼
                 │    Tensor Lib with Numpy-like API
                 │           PATH: heu/numpy
                 │                   │
                 │ ┌─────────────────┘
                 │ │
                 ▼ ▼
         HE SPI (C++ APIs)
         PATH: heu/spi/he
                 │
                 │
                 ▼
 Various HE algorithm implementations
        PATH: heu/algorithms

For a more detailed introduction to SPI, please click here

2024 Work Plan

Architecture Transition Milestones:

  • HE SPI: Designed a unified interface that supports all PHE/FHE algorithms.
  • Implementation of SPI Sketches. (in progress)
  • Migration of existing algorithms to SPI. (in progress)
  • Automated testing framework for PHE/FHE algorithms. (in progress)
  • Transition of Tensor Lib's underlying layer from Dispatcher to SPI.
  • Transition of PyLib's underlying layer from Dispatcher to SPI.

FHE Milestones:

  • Integration of Microsoft SEAL
  • Integration of OpenFHE.
  • Support for GPU-accelerated CKKS algorithm.
  • Provides FHE interfaces in Tensor Lib.
  • Provides FHE interfaces in PyLib.

Compile and install

Environmental requirements

  • CPU
    • x86_64: minimum required AVX instruction set
    • AArch64: ARMv8
  • OS
    • Ubuntu 18.04+
    • Centos 7
    • macOS 12.0+ (macOS Monterey+)1
  • Python
    • Python 3.9+
  1. Due to CI resource limitation, macOS x64 prebuild binary is no longer available.

Install via Pip

pip install sf-heu

Install from source

The following command will automatically compile and install HEU into the default Python environment:

git clone git@github.com:secretflow/heu.git
cd heu
sh build_wheel_entrypoint.sh

Run unit tests (optional)

# just compile, do not run any UT (optional)
bazel build heu/...

# compile and run all UTs
bazel test heu/...

Contribution Guidelines

SecretFlow is an open and inclusive community, and we welcome any kind of contribution. If you want to improve HEU, please refer to Contribution Guide

Metadata

Release files for sf-heu 0.6.0.dev20241015

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

Built distributions (wheels)

Table of built distributions (wheels) for sf-heu 0.6.0.dev20241015
File Interpreter ABI Platform
sf_heu-0.6.0.dev20241015-cp310-cp310-manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64 Details
sf_heu-0.6.0.dev20241015-cp310-cp310-manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
sf_heu-0.6.0.dev20241015-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 16.5 MB

Release files / sf_heu-0.6.0.dev20241015-cp310-cp310-manylinux_2_28_aarch64.whl

Download URL sf_heu-0.6.0.dev20241015-cp310-cp310-manylinux_2_28_aarch64.whl
Size 6.1 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
6a6e618d95a0c6f956f14379379f5007ceea1cd221656d30a8256b110b0f1fad
BLAKE2b-256 checksum
How to use checksums
89ddd569c019e3de3545fe051600dfc252fd9510fda2597911cc53235df1ea56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / sf_heu-0.6.0.dev20241015-cp310-cp310-manylinux2014_x86_64.whl

Download URL sf_heu-0.6.0.dev20241015-cp310-cp310-manylinux2014_x86_64.whl
Size 6.3 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6b159af3156ae45948c7757c1aa68a30979970ac645f0408f0734de2a7e4aee6
BLAKE2b-256 checksum
How to use checksums
ebd2dd2432d435ebeb853d9eff2a6914d127de6753d71b58aa0b8ab3002242f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / sf_heu-0.6.0.dev20241015-cp310-cp310-macosx_11_0_arm64.whl

Download URL sf_heu-0.6.0.dev20241015-cp310-cp310-macosx_11_0_arm64.whl
Size 4.1 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5f61668ed2ed6ccbdf4b9e664b662566a2f5733fdc4036e50a53a491044e8da9
BLAKE2b-256 checksum
How to use checksums
6782d3f50bcc0c0e37489464e62c8b76cf01173b564c8249f0c22fd206a1f88f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15
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