[b01lers2020]safety_in_numbers

查看给的附件,就明白,这对公钥中,n过大,所以我们直接对c开e此方即可

aaa.py中是之前利用python写入的c

from aaa import *
import gmpy2
e = 65537
def dec(ctxt):
   c = ctxt
   eth_root = gmpy2.iroot(c, e)
   if eth_root[1] != True:
      print("not trivial RSA")
   m = int(eth_root[0])
   print(m)
   msg = (m).to_bytes(m.bit_length() // 8 + 1, byteorder = 'little')
   return msg

with open("flag.enc", "rb") as f:
   ctxt = f.read()
   cc = int.from_bytes(ctxt, byteorder = 'little')
print(dec(cc))

 

posted @ 2020-04-06 22:36  S4tan  阅读(683)  评论(0)    收藏  举报