[ create a new paste ] login | about

Link: http://codepad.org/E9oexooE    [ raw code | output | fork ]

Python, pasted on Sep 13:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
n=0xd257c42f17e16815bef4c2f3fede55b5b7ed35fa4ae040aac0515a7bc662f564ac4e98272b61c24b666581479b295833ba9f22d6df733dacd819599fcc757e40a63f88fcbd3007ce7775688e5288a5810add8c1badb4773bff9abb067cf35f5d51bc23f02192cf67a54fbc4e54d7933023511b8812e0f6de8cc8ea1ef2361241

fudge=0xbb4d023f

def xgcd(b, n):
  x0, x1, y0, y1 = 1, 0, 0, 1
  while n != 0:
    q, b, n = b // n, n, b % n
    x0, x1 = x1, x0 - q * x1
    y0, y1 = y1, y0 - q * y1
  return  b, x0, y0

def mulinv(b, n):
  g, x, _ = xgcd(b, n)
  if g == 1:
    return x % n

r = 2**1024
k = (r*mulinv(r, n)-1) // n

print(k % (2**32) == fudge)


Output:
1
True


Create a new paste based on this one


Comments: