[INSHack2017]rsa16m 1

# 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)
root@1ad9c6992813:~# python take_c_to_e_power.py 
b'INSA{(I)NSA_W0uld_bE_pr0uD}'
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值