题目给了n,e,以及40个c的值
思路:在网站上分解n,写一个脚本重复算40次
(在没有看题解的时候,我是这样想的,也这样干了)
看了大佬的脚本,要简洁很多
import gmpy2
from Crypto.Util.number import *
from binascii import a2b_hex, b2a_hex
import binascii
c_list = ['473878130775', '40132555282', '40132555282', '94619939727', '72818765591', '208015808884', '42561234694', '159353248388', '27748063975', '159353248388', '159353248388', '278953790403', '410746718603', '496849210942', '27748063975', '142521857906', '103632267191', '17774494147', '328684046745', '278953790403',
'129956887006', '129956887006', '366275425558', '328684046745', '142521857906', '410746718603', '142521857906', '129956887006', '379067009467', '328684046745', '159353248388', '366275425558', '129956887006', '103632267191', '27748063975', '27748063975', '17774494147', '160623996897', '278953790403', '182341799525']
for i in range(len(c_list)):
e = 65537
# c = 473878130775
# 1.将n分解为p和q
p = 992623
q = 540961
n = p * q
phi = (p - 1) * (q - 1)
# 2.求d
d = gmpy2.invert(e, phi)
# 3.m=pow(c,d,n)
m = gmpy2.powmod(int(c_list[i]), d, n)
print(chr(m), end="")
# binascii.unhexlify(hexstr):从十六进制字符串hexstr返回二进制数据
运行就能得到flag