621 835 247 356 785 436 368 637 79 395 95 121 254 657 781 def my_func

 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
39
40
41
42
43
44
B = [621, 835, 247, 356, 785]
C = [436, 368, 637, 79, 395]
S = [95, 121, 254, 657, 781]
def my_func(eb, db, nb, ec, dc, nc, num_sec_b, num_sec_c):
x1 = pow(C[num_sec_b], eb) % nb
FBI_C = x1 ^ C[num_sec_b]
x2 = pow(B[num_sec_c], ec) % nc
FBI_B = x2 ^ B[num_sec_c]
print ('FBI from Bob - ', bin(FBI_B))
print ('FBI from Carrol - ', bin(FBI_C))
b_shtrih = []
c_shtrih = []
for b in B:
b_shtrih.append(b ^ FBI_B)
for c in C:
c_shtrih.append(c ^ FBI_C)
print ('b_shtrih - ', b_shtrih, 'c_shtrih - ', c_shtrih)
for_bob = []
for_carrol = []
i = 0
for c_s in c_shtrih:
for_bob.append(pow(c_s, db) % nb ^ S[i])
i += 1
i = 0
for b_s in b_shtrih:
for_carrol.append(pow(b_s, dc) % nc ^ S[i])
i += 1
print ('for_bob - ', for_bob, 'for_carrol - ', for_carrol)
S_for_bob = C[num_sec_b] ^ for_bob[num_sec_b]
S_for_carrol = B[num_sec_c] ^ for_carrol[num_sec_c]
print ("Bob's Secret - ", S_for_bob, "Carrol's Secret - ", S_for_carrol)
my_func(13, 61, 851, 17, 2477, 3953, 2, 4)