HWS-Crypto

这场比赛诶,参加的莫名其妙的,还没来得及复现,就做出来一个Crypto。qwq

Crypto

HWS-easyRSA

解题过程:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gmpy2
from Crypto.Util.number import *

m = 31893593182018727625473530765941216190921866039118147474754069955393226712079257707838327486268599271803
seed0 = 25820280412859586557218124484272275594433027771091486422152141535682739897353623931875432576083022273940
seed1 = 24295465524789348024814588142969609603624462580932512051939198335014954252359986260009296537423802567677
seed2 = 14963686422550871447791815183480974143372785034397446416396172429864269108509521776424254168481536292904

a = (seed2 - seed1) * gmpy2.invert(seed1 - seed0, m) % m
b = (seed1 - a * seed0) % m

MMI = lambda A, m, s=1, t=0, N=0: (m < 2 and t % N or MMI(m, A % m, t, s - A // m * t, N or m), -1)[m < 1] # 逆元计算
ani = MMI(a, m)
seed = seed2
for i in range(3):
seed = (ani * (seed - b)) % m
print(long_to_bytes(seed))