nucypher / nufhe

NuCypher fully homomorphic encryption (NuFHE) library implemented in Python
https://nufhe.readthedocs.io/en/latest/
GNU General Public License v3.0
441 stars 53 forks source link

gate_mux with the OverflowError :"Python int too large to convert to C long" #40

Open samartfang opened 2 years ago

samartfang commented 2 years ago

Hello, I want to use gate_mux, but I get an error "Python int too large to convert to C long" when compiling. Do you know what the reason is?

` import random import numpy import nufhe from reikna.cluda import any_api size = 32 bits1 = [random.choice([False, True]) for i in range(size)] bits2 = [random.choice([False, True]) for i in range(size)] bits3 = [random.choice([False, True]) for i in range(size)]

thr = any_api().Thread.create(interactive=True) rng = nufhe.DeterministicRNG() secret_key, cloud_key = nufhe.make_key_pair(thr, rng) ciphertext1 = nufhe.encrypt(thr, rng, secret_key, bits1) ciphertext2 = nufhe.encrypt(thr, rng, secret_key, bits2) ciphertext3 = nufhe.encrypt(thr, rng, secret_key, bits3) result = nufhe.empty_ciphertext(thr, cloud_key.params, ciphertext1.shape) nufhe.gate_mux(thr, cloud_key, result, ciphertext1, ciphertext2, ciphertext3)

result_bits = nufhe.decrypt(thr, secret_key, result) `