CTF/system32.kr
[system32.kr] RSA102
pental
2020. 9. 28. 16:17
n = 17492679505633780091591558120277848189
e = 65537
c = 494188309631797349948909951854662875
RSA101 문제 ) blog.system32.kr/195
[system32.kr] RSA101
p = 11820547749265118607908336189140061659994883367758644383099900753008997316272341754974105712436833864387373302687964986221522289414610698068230842231006759 q = 207647838869071544764422239229558..
blog.system32.kr
101 문제에서는 p, q, e, c가 주어졌지만 이번엔 n이 주어졌다.
n 값은 n = p * q 로 일반적으로 알고있다.
Integer factorization calculator
www.alpertron.com.ar
이것을 사용해서 p, q값을 구해준다.
n = 2 071997 351323 275967 × 8 442423 680928 995267
n = 2 071997 351323 275967 × 8 442423 680928 995267
# -*- coding: utf-8 -*-
import crypto
from gmpy2 import *
n = 17492679505633780091591558120277848189
e = 65537
c = 494188309631797349948909951854662875
p = 2071997351323275967
q = 8442423680928995267
n = p * q
phi = (p - 1) * (q - 1)
d = divm(1, e, phi)
result = ('%x' % pow(c, d, n))
print(result)
print(bytes.fromhex(result).decode('utf-8'))