Created
November 27, 2018 09:08
-
-
Save samueltangz/819e0a664b5537138dec92e2c9c45a3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import gmpy | |
from Crypto.Util.number import * | |
from secret import x, y, flag | |
assert gmpy.is_prime(y) | |
assert gmpy.is_prime(x+1) | |
assert (x**2 - 1)**2 % (4*x*y - 1) == 0 | |
p = gmpy.next_prime(x**5 + y**5) | |
q = gmpy.next_prime(x**2*y**3 + y**2*x**3) | |
n = p * q | |
enc = pow(bytes_to_long(flag), 0x10001, n) | |
print 'n =', n | |
print 'enc =', enc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment