Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nucypher/nufhe
NuCypher fully homomorphic encryption (NuFHE) library implemented in Python
https://github.com/nucypher/nufhe
Last synced: about 2 months ago
JSON representation
NuCypher fully homomorphic encryption (NuFHE) library implemented in Python
- Host: GitHub
- URL: https://github.com/nucypher/nufhe
- Owner: nucypher
- License: gpl-3.0
- Archived: true
- Created: 2018-04-08T05:17:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T21:29:13.000Z (over 2 years ago)
- Last Synced: 2024-10-13T11:58:02.949Z (2 months ago)
- Language: Python
- Homepage: https://nufhe.readthedocs.io/en/latest/
- Size: 444 KB
- Stars: 441
- Watchers: 23
- Forks: 53
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-fhe - NuFHE - GPU-accelerated HE library, faster than cuFHE, that implements the [tfhe](#tfhe) algorithms. (Libraries / [Sunscreen](https://sunscreen.tech/))
- DeFi-Developer-Road-Map - NuFHE - GPU accelerated FHE library (Roadmap)
- awesome-he - NuFHE - GPU-accelerated HE library, faster than cuFHE, that implements the [tfhe](#tfhe) algorithms. (Libraries)
README
# A GPU implementation of fully homomorphic encryption on torus
This library implements the fully homomorphic encryption algorithm from [`TFHE`](https://github.com/tfhe/tfhe) using CUDA and OpenCL. Unlike `TFHE`, where FFT is used internally to speed up polynomial multiplication, `nufhe` can use either FFT or purely integer NTT (DFT-like transform on a finite field). The latter is based on the arithmetic operations and NTT scheme from [`cuFHE`](https://github.com/vernamlab/cuFHE). Refer to the [project documentation](https://nufhe.readthedocs.io/en/latest/) for more details.
## Usage example
```python
import random
import nufhesize = 32
bits1 = [random.choice([False, True]) for i in range(size)]
bits2 = [random.choice([False, True]) for i in range(size)]
reference = [not (b1 and b2) for b1, b2 in zip(bits1, bits2)]ctx = nufhe.Context()
secret_key, cloud_key = ctx.make_key_pair()ciphertext1 = ctx.encrypt(secret_key, bits1)
ciphertext2 = ctx.encrypt(secret_key, bits2)vm = ctx.make_virtual_machine(cloud_key)
result = vm.gate_nand(ciphertext1, ciphertext2)
result_bits = ctx.decrypt(secret_key, result)assert all(result_bits == reference)
```## Performance
Platform
Library
Performance (ms/bit)
Binary Gate
MUX Gate
Single Core/Single GPU - FFT
TFHE (CPU)
13
26
nuFHE
0.13
0.22
Speedup
100.9
117.7
Single Core/Single GPU - NTT
cuFHE
0.35
N/A
nuFHE
0.35
0.67
Speedup
1.0
-