Skip to content

Instantly share code, notes, and snippets.

@samueltangz
Created February 13, 2021 13:36
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 samueltangz/90c25bcf60e6c023c34b817b84d61cad to your computer and use it in GitHub Desktop.
Save samueltangz/90c25bcf60e6c023c34b817b84d61cad to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from gmpy2 import iroot
def main():
e = 65537
n = 7504521114311153672308826977564891107288058227100173341193360340321176562970983694756086045753375611733443716948010092176135133045533366956059169702726409
c = 3120246791506259955679234385495683489853187127801200033777823093969698684663885288175101358075188702658492281935014546035799989917015048182861857825663454
p, ok = iroot(n, 2)
assert ok
p = int(p)
phi = p * (p-1)
d = pow(e, -1, phi)
m = pow(c, d, n)
flag = m.to_bytes(32, 'big')
print(flag)
# kurenaifCTF{phi_is_not_p-1_p-1}
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment