Skip to content

Instantly share code, notes, and snippets.

@Lense
Last active December 6, 2015 19:05
Show Gist options
  • Save Lense/de1f9eb1a1c86485d16e to your computer and use it in GitHub Desktop.
Save Lense/de1f9eb1a1c86485d16e to your computer and use it in GitHub Desktop.
SECCON 2015--Find the prime numbers--Crypto200
#!/usr/bin/python3
c = 3089536481493958504
o = 430963121498067364
h = 2520077868883606433
n = 1
while True:
if (c*o)%pow(n,2) == o:
print(n)
break
n += 1
# n = 251051
def L(u):
return (u-1)//n
p,q = factor(n)
phi = (p-1)*(q-1)
print((L(pow(c, phi, n**2))*modinv(phi, n))%n)
# 1510490612
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment