Intel出的Python版Paillier包,Github地址:GitHub - intel/pailliercryptolib_python: Intel Paillier Cryptosystem Library is an open-source library which provides accelerated performance of a partial homomorphic encryption (HE), named Paillier cryptosystem, by utilizing Intel? IPP-Crypto technologies on Intel CPUs supporting the AVX512IFMA instructions. The library is written in modern standard C++ and provides the essential API for the Paillier cryptosystem scheme. Intel Paillier Cryptosystem Library - Python is a Python extension package intended for Python based privacy preserving machine learning solutions which utilizes the partial HE scheme for increased data and model protection.Intel Paillier Cryptosystem Library is an open-source library which provides accelerated performance of a partial homomorphic encryption (HE), named Paillier cryptosystem, by utilizing Intel? IPP-Crypto technologies on Intel CPUs supporting the AVX512IFMA instructions. The library is written in modern standard C++ and provides the essential API for the Paillier cryptosystem scheme. Intel Paillier Cryptosystem Library - Python is a Python extension package intended for Python based privacy preserving machine learning solutions which utilizes the partial HE scheme for increased data and model protection. - GitHub - intel/pailliercryptolib_python: Intel Paillier Cryptosystem Library is an open-source library which provides accelerated performance of a partial homomorphic encryption (HE), named Paillier cryptosystem, by utilizing Intel? IPP-Crypto technologies on Intel CPUs supporting the AVX512IFMA instructions. The library is written in modern standard C++ and provides the essential API for the Paillier cryptosystem scheme. Intel Paillier Cryptosystem Library - Python is a Python extension package intended for Python based privacy preserving machine learning solutions which utilizes the partial HE scheme for increased data and model protection.https://github.com/intel/pailliercryptolib_python
这个包说是需要CPU指令支持AVX512IFMA ,但是实际上不支持其实也能用,首先安装依赖:
- Python版本:我选的Python3.8,因为后续安装需要依赖numpy==1.23.1,但是这个版本比较新在Python3.7里面好像没有,所以我用的Python3.8
- GCC/G++版本:实测不要用高版本,我最开始用了GCC-11,最后虽然包能装上但是在Python里import包时会报依赖项“GLIBCXX_3.4.29”找不到,也不要用低版本(GCC-7及以下)这个包的安装至少是要GCC-8.2。我用的GCC-8.4,没有问题
- 依赖库:除nasm外其他几个包直接apt安装即可:apt install libgmp-dev libmpfr-dev libmpc-dev libomp-dev?libssl-dev?libnuma-dev
- nasm >= 2.15:这个依赖比较关键,版本必须要大于2.15,否则安装过程会提示os.inc、asmdefs.inc文件找不到,最后会报一个recipe for target ‘xxx‘ failed。所以这个包的版本一定要装对。我直接通过apt install nasm安装上的是2.13版本,实测这个2.13不能用。可以从官网下载https://nasm.us/,官网提供的rpm格式,如果是ubuntu系统,可以使用alien命令转成deb格式进行安装
- OpenSSL >= 1.1.0
- numa >= 2.0.12
- gmp >= 5.0.0
- mpfr >= 3.1.0
- 安装:python setup.py install
实测这个包相对于Python-Phe在加密和解密操作上都可以快出10倍,如果CPU指令集支持AVX512IFMA应该还可以更快。需要注意的是Intel的这个包原生是基于一维数组做加解密的,如果要扩展到多维可能需要自己进行一些调整。
|