Tags: crypto
Rating:
<span>This is standard Diffie Hellman. To find the correct shared secret, we need the values for a and b. They can be easily bruteforced:
-----------------------------
p = 6703903964971298549787012499102923063739682910296196688861780721860882015036773488400937149083451713845015929093243025426876941405973284973216824503042047
g = 9444732965739290427392
g_a = 842498333348457493583344221469363458551160763204392890034487820288
g_b = 89202980794122492566142873090593446023921664
A = g_a % p
B = g_b % p
def shared_secret(A, B):
for a in range(3, 300):
s_a = pow(B, a, p)
for b in range(3, 300):
s_b = pow(A, b, p)
if s_a == s_b and s_a == pow(g, a*b, p):
return s_a
secret = shared_secret(A, B)
<span>print str(secret)[:20]
</span><span>-----------------------------------------------
Output:
</span>
<span>70980344169492860405
</span>
</span>