# Challenge description:
When you need really secure communications, you use RSA with a 4096 bit key.<br>
I want really really really secure communications to transmit the nuclear launch codes (yeah IoT is everywhere man) so I used RSA with a 16777216 bit key. Surely russians will not be able to factor that one ! <br>
File md5 : 1049a0c83a2e34760363b4ad9778753f
题目给出了
n
n
n、
e
e
e、
c
c
c,
n
n
n和
c
c
c很大,复制粘贴完全没有可能,
e
e
e是
65537
65537
65537
网上给出的答案是直接开
c
c
c的
e
e
e次方
代码如下:
import gmpy2
#读取
data =open('rsa_16m.txt','r').read().split('\n')#这里读取到的data是一个数组
m = gmpy2.iroot(int(data[1][4:],16),int(data[2][4:],16))[0]
踩了坑后自写的代码,可以运行
from gmpy2 import iroot, mpz
# 读取
data =open('rsa_16m','r').read().split('\n')# c位于第二行,e位于第三行# 第一个字符在下标6
c = mpz(int(data[1][6:],16))
e = mpz(int(data[2][6:],16))# iroot是个列表,很神奇
m =int(iroot(c, e))assert m[1]
flag =bytes.fromhex(hex(m[0])[2:])print(flag)