You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.
zero= np.zeros((size,), dtype=bool)
A = fixSizeBoolList(3,size)
B = fixSizeBoolList(2,size)
theta = fixSizeBoolList(0,size)
temp=fixSizeBoolList(0,size)
Y = fixSizeBoolList(7,size)
ciX=ctx.encrypt(secret_key, A)
ciY=ctx.encrypt(secret_key, B)
print("cix:",ctx.decrypt(secret_key, ciX))
print("ciy:",ctx.decrypt(secret_key, ciY))
enc_theta=ctx.encrypt(secret_key, theta)
enc_temp=ctx.encrypt(secret_key, theta)
enc_val=ctx.encrypt(secret_key, Y)
abc=vm.gate_constant(zero)
begin = time.time()
#not_result=equal_check(ciX, ciY)
for j in range(0,size):
print("=================iteration==========",j)
ciX=ciX
print("cix:",ctx.decrypt(secret_key, ciX))
enc_theta=shift(ciX)
for i in range(size):
enc_temp[i]=ciY[j]
abc=vm.gate_copy(enc_temp)
print("enc_theta:",ctx.decrypt(secret_key, enc_theta))
'''for i in range(size):
abc.a[i]=ciY.a[j]
abc.b[i]=ciY.b[j]'''
print("Abc:",ctx.decrypt(secret_key, enc_temp))
mux_result=vm.gate_mux(enc_temp, enc_theta,ciX)
print("mux result:",ctx.decrypt(secret_key, mux_result))
ciX=mux_result
end = time.time()
print(f"Total runtime for 32-bit full adder is {float(end - begin)} second")
#assert all(result_bits == reference)
zero= np.zeros((size,), dtype=bool)
A = fixSizeBoolList(3,size)
B = fixSizeBoolList(2,size)
theta = fixSizeBoolList(0,size)
temp=fixSizeBoolList(0,size)
Y = fixSizeBoolList(7,size)
ciX=ctx.encrypt(secret_key, A)
ciY=ctx.encrypt(secret_key, B)
print("cix:",ctx.decrypt(secret_key, ciX))
print("ciy:",ctx.decrypt(secret_key, ciY))
enc_theta=ctx.encrypt(secret_key, theta)
enc_temp=ctx.encrypt(secret_key, theta)
enc_val=ctx.encrypt(secret_key, Y)
abc=vm.gate_constant(zero)
begin = time.time()
#not_result=equal_check(ciX, ciY)
for j in range(0,size):
print("=================iteration==========",j)
ciX=ciX
print("cix:",ctx.decrypt(secret_key, ciX))
enc_theta=shift(ciX)
for i in range(size):
enc_temp[i]=ciY[j]
abc=vm.gate_copy(enc_temp)
print("enc_theta:",ctx.decrypt(secret_key, enc_theta))
'''for i in range(size):
abc.a[i]=ciY.a[j]
abc.b[i]=ciY.b[j]'''
print("Abc:",ctx.decrypt(secret_key, enc_temp))
mux_result=vm.gate_mux(enc_temp, enc_theta,ciX)
print("mux result:",ctx.decrypt(secret_key, mux_result))
ciX=mux_result
end = time.time()
print(f"Total runtime for 32-bit full adder is {float(end - begin)} second")
#assert all(result_bits == reference)
result=ctx.decrypt(secret_key, ciX)
#print("mux result:",)
print("result is",boolListToInt(result))
After tracing result is
cix: [ True True False False False False False False]
ciy: [False True False False False False False False]
=================iteration========== 0
cix: [ True True False False False False False False]
enc_theta: [False True True False False False False False]
Abc: [False False False False False False False False]
mux result: [False True True False False False False False]
=================iteration========== 1
cix: [False True True False False False False False]
enc_theta: [False False True True False False False False]
Abc: [ True True True True True True True True]
/usr/local/lib/python3.9/dist-packages/google/colab/_variable_inspector.py:27: UserWarning: device_allocation in out-of-thread context could not be cleaned up
globals().clear()
/usr/local/lib/python3.9/dist-packages/google/colab/_variable_inspector.py:27: UserWarning: device_allocation in out-of-thread context could not be cleaned up
globals().clear()
mux result: [False False True True False False False False]
=================iteration========== 2
cix: [False False True True False False False False]
enc_theta: [False False False True True False False False]
Abc: [False False False False False False False False]
mux result: [False False False True True False False False]
=================iteration========== 3
cix: [False False False True True False False False]
enc_theta: [False False False False True True False False]
Abc: [False False False False False False False False]
mux result: [False False False False True True False False]
=================iteration========== 4
cix: [False False False False True True False False]
enc_theta: [False False False False False True True False]
Abc: [False False False False False False False False]
mux result: [False False False False False True True False]
=================iteration========== 5
cix: [False False False False False True True False]
enc_theta: [False False False False False False True True]
Abc: [False False False False False False False False]
mux result: [False False False False False False True True]
=================iteration========== 6
cix: [False False False False False False True True]
enc_theta: [False False False False False False False True]
Abc: [False False False False False False False False]
mux result: [False False False False False False False True]
=================iteration========== 7
cix: [False False False False False False False True]
enc_theta: [False False False False False False False False]
Abc: [False False False False False False False False]
mux result: [False False False False False False False False]
Total runtime for 32-bit full adder is 0.6157827377319336 second
result is 0
/usr/local/lib/python3.9/dist-packages/google/colab/_variable_inspector.py:27: UserWarning: device_allocation in out-of-thread context could not be cleaned up
globals().clear()
/usr/local/lib/python3.9/dist-packages/google/colab/_variable_inspector.py:27: UserWarning: device_allocation in out-of-thread context could not be cleaned up
globals().clear()
The text was updated successfully, but these errors were encountered: