-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repo-sync-2023-11-28T19:05:47+0800 (#107)
- Loading branch information
Showing
25 changed files
with
382 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,64 +3,83 @@ | |
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/secretflow/heu/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/secretflow/heu/tree/main) | ||
![PyPI version](https://img.shields.io/pypi/v/sf-heu) | ||
|
||
Homomorphic Encryption processing Unit (HEU) is a subproject of Secretflow that | ||
implements high-performance homomorphic encryption algorithms. | ||
[中文](README_cn.md) | ||
|
||
The purpose of HEU is to lower the threshold for the use of homomorphic | ||
encryption, so that users can use homomorphic encryption algorithms to build | ||
privacy-preserving applications without professional cryptography knowledge. | ||
HEU (Homomorphic Encryption processing Unit) is a user-friendly and high-performance homomorphic | ||
encryption library that supports multiple types and scalable hardware acceleration. | ||
|
||
## Documentation | ||
## document | ||
|
||
https://www.secretflow.org.cn/docs/heu/ | ||
|
||
## Background | ||
## Repo status | ||
|
||
This project consists of two parts: | ||
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. | ||
|
||
HE Library (currently implemented): This project can be used as a | ||
high-performance and complete homomorphic encryption library, which integrates | ||
almost all homomorphic encryption algorithms in the industry. At the same time, | ||
HEU encapsulates each algorithm and provides a uniform interface. You can switch | ||
between different HE algorithms at any time without modifying business code. | ||
Supported algorithms: | ||
|
||
HE device (in work): As a component of Secretflow, HEU abstracts the homomorphic | ||
encryption algorithms into a programmable device, making it easy for users to | ||
flexibly build applications using the homomorphic encryption technology without | ||
professional knowledge. HEU (device) aims to build a complete computing solution | ||
through HE, that is, based on HE, any type of computing can be completed. | ||
Compared with PPU, HEU's computation is purely local without any network | ||
communication, so HEU and PPU are complementary | ||
- 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. | ||
|
||
Depending on the computing power, HEU has 4 working modes: | ||
Each algorithm includes a variety of different implementations, and some implementations support | ||
hardware accelerators. For more details, please refer to | ||
the [Document](https://www.secretflow.org.cn/docs/heu/latest/zh-Hans/getting_started/algo_choice ) | ||
|
||
| working mode | Supported calculation types | Number of calculations | HE algorithms | Calculating speed | Ciphertext size | | ||
|-----------------------|-------------------------------------------|------------------------|----------------|--------------------|---------------------| | ||
| PHEU | addition | Unlimited | Paillier, OU | Fast | Small | | ||
| LHEU | addition, multiplication | Limited | BGV, CKKS | Fast (packed mode) | Least (packed mode) | | ||
| FHEU (low precision) | addition, mux, LUT | Unlimited | TFHE (Torus) | Fastest | Large | | ||
| FHEU (high precision) | addition, multiplication, comparison, mux | Unlimited | TFHE (Bitwise) | Very slow | Largest | | ||
## Compile and install | ||
|
||
## Repo status | ||
### Environmental requirements | ||
|
||
- CPU | ||
- x86_64: minimum required AVX instruction set | ||
- AArch64: ARMv8 | ||
- OS | ||
- Ubuntu 18.04+ | ||
- Centos 7 | ||
- macOS 11.1+ (macOS Big Sur+) | ||
- Python | ||
- Python 3.8+ | ||
|
||
PHE has been basically developed, LHE and FHE are under development | ||
### Install via Pip | ||
|
||
## Build & UnitTest | ||
```shell | ||
pip install sf-heu | ||
``` | ||
|
||
Build all | ||
### Install from source | ||
|
||
The following command will automatically compile and install HEU into the default Python | ||
environment: | ||
|
||
```shell | ||
# build all | ||
bazel build heu/... | ||
git clone [email protected]:secretflow/heu.git | ||
cd heu | ||
sh build_wheel_entrypoint.sh | ||
|
||
# test all (optional) | ||
bazel test heu/... | ||
``` | ||
|
||
Build python lib | ||
### Run unit tests (optional) | ||
|
||
|
||
|
||
|
||
|
||
```shell | ||
# build and install python library | ||
sh build_wheel_entrypoint.sh | ||
# 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](CONTRIBUTING.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# HEU | ||
|
||
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/secretflow/heu/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/secretflow/heu/tree/main) | ||
![PyPI version](https://img.shields.io/pypi/v/sf-heu) | ||
|
||
HEU(Homomorphic Encryption processing Unit)是一个低门槛、高性能的同态加密库,支持多类型、可扩展的硬件加速生态。 | ||
|
||
## 文档 | ||
|
||
https://www.secretflow.org.cn/docs/heu/ | ||
|
||
## 开发状态 | ||
|
||
同态加密算法主要分为半同态(PHE)和全同态(FHE)两大类,目前 HEU 已支持大部分 PHE 算法,而 FHE 仍需要一段时间的开发 | ||
|
||
支持的算法: | ||
|
||
- 加法同态加密 | ||
- Paillier (推荐) | ||
- Okamoto–Uchiyama (推荐) | ||
- EC ElGamal | ||
- Damgard-Jurik | ||
- Damgard-Geisler-Krøigaard (DGK) | ||
- 全同态加密 | ||
- 正在开发中,并且是当前 HEU 的工作重心 | ||
|
||
其中每一类算法又包含多种不同的实现,部分实现支持硬件加速器,详见[文档](https://www.secretflow.org.cn/docs/heu/latest/zh-Hans/getting_started/algo_choice) | ||
|
||
## 编译和安装 | ||
|
||
### 环境要求 | ||
|
||
- CPU | ||
- x86_64: 至少支持 AVX 指令集 | ||
- AArch64: ARMv8 | ||
- OS | ||
- Ubuntu 18.04+ | ||
- Centos 7 | ||
- macOS 11.1+ (macOS Big Sur+) | ||
- Python | ||
- Python 3.8+ | ||
|
||
### 通过 Pip 安装 | ||
|
||
```shell | ||
pip install sf-heu | ||
``` | ||
|
||
### 从源码安装 | ||
|
||
以下命令将自动编译并安装 HEU 到默认 Python 环境: | ||
|
||
```shell | ||
git clone [email protected]:secretflow/heu.git | ||
cd heu | ||
sh build_wheel_entrypoint.sh | ||
|
||
``` | ||
|
||
### 运行单元测试(可选) | ||
|
||
|
||
|
||
|
||
|
||
```shell | ||
# just compile, do not run any UT (optional) | ||
bazel build heu/... | ||
|
||
# compile and run all UTs | ||
bazel test heu/... | ||
``` | ||
|
||
## 贡献指南 | ||
|
||
隐语是一个非常包容和开放的社区,我们欢迎任何形式的贡献,如果您想要改进 | ||
HEU,请参考[贡献指南](CONTRIBUTING.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.