Skip to content

Instantly share code, notes, and snippets.

@s4yed
Created March 20, 2020 16:49
Show Gist options
  • Save s4yed/3abadc73a473d8bba9f157944f738ece to your computer and use it in GitHub Desktop.
Save s4yed/3abadc73a473d8bba9f157944f738ece to your computer and use it in GitHub Desktop.
This is my code for RSA angstromCTF 2020.
#!/usr/bin/env python
def modinv(a, m) :
a = a % m;
for x in range(1, m) :
if ((a * x) % m == 1) :
return x
return 1
n = 126390312099294739294606157407778835887
e = 65537
c = 13612260682947644362892911986815626931
p = 13536574980062068373
q = 9336949138571181619
phi = (p-1) * (q-1)
d = modinv(e, phi)
m = hex(pow(c,d,n))[2:-1]
print str(m).decode('hex')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment