[system32.kr] RSA101
p = 11820547749265118607908336189140061659994883367758644383099900753008997316272341754974105712436833864387373302687964986221522289414610698068230842231006759
q = 2076478388690715447644222392295584753007140199740835763821170999934221864895193172716587341806099928941239417181782165665806324184552950128351328886814107
e = 65537
c = 15175007508230661949213125841853820919948368859221761481847700530363990883761097704372435675552656459480039957857925187102590466676354015036181849182155680399350099015532296504916485091012255771133872737687990897080899160898509685794777509104691093814282101492973637294053730555124794841034604131492169339102
p, q, e, c가 주어진다. => 결국 d값을 구하는것
defenit.kr/2019/09/24/Crypto/%E3%84%B4%20Research/RSA_for_CTF/
RSA에 대해서 잘 정리 되어 있다.
import crypto
from gmpy2 import *
p = 11820547749265118607908336189140061659994883367758644383099900753008997316272341754974105712436833864387373302687964986221522289414610698068230842231006759
q = 2076478388690715447644222392295584753007140199740835763821170999934221864895193172716587341806099928941239417181782165665806324184552950128351328886814107
e = 65537
c = 15175007508230661949213125841853820919948368859221761481847700530363990883761097704372435675552656459480039957857925187102590466676354015036181849182155680399350099015532296504916485091012255771133872737687990897080899160898509685794777509104691093814282101492973637294053730555124794841034604131492169339102
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'))
'CTF > system32.kr' 카테고리의 다른 글
[system32.kr] RSA105 (0) | 2020.09.28 |
---|---|
[system32.kr] RSA104 (0) | 2020.09.28 |
[system32.kr] RSA103 (0) | 2020.09.28 |
[system32.kr] RSA102 (0) | 2020.09.28 |
댓글
이 글 공유하기
다른 글
-
[system32.kr] RSA105
[system32.kr] RSA105
2020.09.28 -
[system32.kr] RSA104
[system32.kr] RSA104
2020.09.28 -
[system32.kr] RSA103
[system32.kr] RSA103
2020.09.28 -
[system32.kr] RSA102
[system32.kr] RSA102
2020.09.28