예제 #1
0
def LoadPubKey(pubfile="pubkey.txt"):
    pubkey = fhe.PubKey()
    fhe.ReadPubKeyFromFile(pubkey, pubfile)
    return pubkey
예제 #2
0
# 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)
예제 #3
0
def PubKeyGen(prikey):
    pubkey = fhe.PubKey()
    fhe.PubKeyGen(pubkey, prikey)
    return pubkey