Skip to content
NuCypher fully homomorphic encryption (NuFHE) library implemented in Python
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci circleci/config: add the context for PyPi deployment Oct 14, 2018
doc Bump version: 0.0.1 → 0.0.2 Feb 14, 2019
examples examples: add a multi-threading multi-gpu usage example Jan 27, 2019
nufhe api_high_level: add find_devices(), DeviceID class and the device_id … Jan 27, 2019
test Expose `clear_computation_cache()` and make it clear the cache based … Jan 27, 2019
.gitignore gitignore: add some exceptions for generated files Aug 18, 2018 Change license: MIT -> GPLv3 Aug 15, 2018 Add a high-level API (a context + a virtual machine) hiding Reikna de… Dec 19, 2018 Bump version: 0.0.1 → 0.0.2 Feb 14, 2019

A GPU implementation of fully homomorphic encryption on torus

This library implements the fully homomorphic encryption algorithm from 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. Refer to the project documentation for more details.

Usage example

import random
import nufhe

size = 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)


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 -
You can’t perform that action at this time.