Skip to main content

Homomorphic Encryption processing Unit (HEU) is a subproject of Secretflow that implements high-performance homomorphic encryption algorithms.

Project description

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

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.

sf_heu-0.6.0.dev20250507-cp310-cp310-manylinux_2_28_aarch64.whl (6.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

sf_heu-0.6.0.dev20250507-cp310-cp310-macosx_11_0_arm64.whl (3.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file sf_heu-0.6.0.dev20250507-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for sf_heu-0.6.0.dev20250507-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 525331102c6977c469dfd625e1bc9b5c24c5bc8a8920c74f8c941d98b449100a
MD5 c466cc72145109b0bf37d1fd44ad7c71
BLAKE2b-256 b348a8c5483cc50bdd821ee74c6a36c2c846903a132e6c430589088af91c762c

See more details on using hashes here.

File details

Details for the file sf_heu-0.6.0.dev20250507-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sf_heu-0.6.0.dev20250507-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4c32863342bda379673b1fdde2f701cb6e3e2d9e692a80a4df920a5a859f3b1c
MD5 fde3819cf8d937d09a6a607233cc8c8c
BLAKE2b-256 7049db30a7f4d880179513ac84bf6511b4d61db87c2d8f6e1e8fcfdb2a56c101

See more details on using hashes here.

File details

Details for the file sf_heu-0.6.0.dev20250507-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sf_heu-0.6.0.dev20250507-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b29fe5070336dd4eac8ebacbe8983befe46139a6f76429a34c3ed7c6a0e690da
MD5 3d26a85ff2d5593c0a628f6c54f81751
BLAKE2b-256 ccd6574deb0806b9942759051dba6c912f4748660d543fbde1819281e147a96d

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