def LoadPubKey(pubfile="pubkey.txt"): pubkey = fhe.PubKey() fhe.ReadPubKeyFromFile(pubkey, pubfile) return pubkey
# This gives more flexibility to the designer, if they want full # control over Cuda streams. # If you want a simple Python interface, check "test_circuits.py" out. import lib.fhepy_gpu as fhe import time import random import timeit # Rand Seeds random.seed() fhe.SetSeed(int(time.time())) kNumTests = 3000 # Keys pubkey = fhe.PubKey() prikey = fhe.PriKey() fhe.KeyGen(pubkey, prikey) fhe.Initialize(pubkey) # Plaintexts & Ciphertexts & Cuda Stream ptxts1 = [] ptxts2 = [] ctxts1 = [] ctxts2 = [] st = [] for i in range(kNumTests): ptxts1.append(fhe.Ptxt()) ptxts2.append(fhe.Ptxt()) ptxts1[i].message = random.randint(0, 1) ptxts2[i].message = random.randint(0, 1)
def PubKeyGen(prikey): pubkey = fhe.PubKey() fhe.PubKeyGen(pubkey, prikey) return pubkey