本次比赛是密码专场,今天三场比赛要打QWQ
就打了第一道QWQ

bestkasscn的超级简单密码

题目:

p = getPrime(1024)
i = 0
while True:
r = p * 5 + i
if isPrime(r):
i = 0
break
else:
i += 1
while True:
q = p * 10 + i
if isPrime(q):
break
else:
i += 1

n = p * q * r
e = 65537
c = pow(bytes_to_long(flag.encode()), e, n)
print('c=' + str(c))
print('p3=' + str(pow(p, 3, n)))
print('q3=' + str(pow(q, 3, n)))
print('r3=' + str(pow(r, 3, n)))

本题的突破点是p
不难发现p3是p的倍数,分解发现,p3=p3p3=p^3
直接上脚本(送分)

from Crypto.Util.number import *

p = 96241803526087516516438618680574139229212699224895199026126947479609515703069904259770933066463243844738712136916991719874179296797623802919752542053959297743706931240798992583332970879091497936378700193716012227086531507335444090574605921869576355704757589370608232721639204280020820678250787751406162350723
i = 0
while True:
r = p * 5 + i
if isPrime(r):
i = 0
break
else:
i += 1
while True:
q = p * 10 + i
if isPrime(q):
break
else:
i += 1
n = p*q*r
c = 11212699652154912414419576042130573737460880175860430868241856564678915039929479534373946033032215673944727767507831028500814261134142245577246925294110977629353584372842303558820509861245550773062016272543030477733653059813274587939179134498599049035104941393508776333632172797303569396612594631646093552388772109708942113683783815011735472088985078464550997064595366458370527490791625688389950370254858619018250060982532954113416688720602160768503752410505420577683484807166966007396618297253478916176712265476128018816694458551219452105277131141962052020824990732525958682439071443399050470856132519918853636638476540689226313542250551212688215822543717035669764276377536087788514506366740244284790716170847347643593400673746020474777085815046098314460862593936684624708574116108322520985637474375038848494466480630236867228454838428542365166285156741433845949358227546683144341695680712263215773807461091898003011630162481
phi = (p-1)*(q-1)*(r-1)
d = inverse(0x10001, phi)
print(long_to_bytes(pow(c, d, n)))
# b'NSSCTF{cc10786a-cc59-a07d-5c9f-df1c55b18cd4}'