forked from cy1c0n9/SecureMultiPartyComputation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbob_ot.py
More file actions
38 lines (31 loc) · 696 Bytes
/
bob_ot.py
File metadata and controls
38 lines (31 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import zmq
import random
import sys
import time
import ot
import numpy
def bob(b, socket):
"""
:param b: int 0 or 1, bob's choice
:param socket: socket, connected socket
:return:
"""
bob_ = ot.Bob(b)
c = socket.recv()
c = int(c)
# print("received c:"+str(c))
h0 = bob_.bob_setup(c)
# print("send h0:"+str(h0))
socket.send_string(str(h0))
# print("have sent h0"+str(h0))
c1 = socket.recv()
c1 = int(c1)
# print("c1:"+str(c1))
e0 = socket.recv()
# print("receive e0:"+str(e0))
e1 = socket.recv()
# print("receive e1:" + str(e1))
mb = bob_.bob_decode(c1, e0, e1)
return mb
# b = 0
# print(bob(b))