Skip to content

Instantly share code, notes, and snippets.

@autotaker
Created December 6, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save autotaker/e65da419e982225b22de to your computer and use it in GitHub Desktop.
Save autotaker/e65da419e982225b22de to your computer and use it in GitHub Desktop.
from Crypto.Util import number
a = 2622440554406490912
b = 147433867683690946
c = 4258610457570922687
p = 42727
q = 58757
n = p * q
print(a * b - c)
print(n)
x = b * number.inverse(n + 1, n * n) % (n * n)
n1 = a * number.inverse(x, n * n) % (n * n)
assert x * n1 * (n + 1) * x % (n * n) == c
print("znlog(%d,Mod(%d, %d))" % (n1 ,n+1, n*n))
m = int(input())
assert x * pow(n + 1, m, n * n) % (n * n) == a
assert x * (n + 1) % (n * n) == b
assert x * x * pow(n + 1, m + 1, n * n) % (n * n) == c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment