-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsol.sage
25 lines (18 loc) · 819 Bytes
/
sol.sage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from Crypto.Util.number import *
e = 5
n = 6689395968128828819066313568755352659933786163958960509093076953387786003094796620023245908431378798689402141767913187865481890531897380982752646248371131
c1 = 3179086897466915481381271626207192941491642866779832228649829433228467288272857233211003674026630320370606056763863577418383068472502537763155844909495261
c2 = 6092690907728422411002652306266695413630015459295863614266882891010434275671526748292477694364341702119123311030726985363936486558916833174742155473021704
'''
m2 == m1 >> 8
(m2 << 8)^e == (m2*256)^e
'''
P.<x> = PolynomialRing(Zmod(n))
g1 = (256*x + ord('}'))^e - c1
g2 = x^e - c2
while g2:
g1, g2 = g2, g1 % g2
g = g1.monic()
assert g.degree() == 1
print(long_to_bytes(int(-g[0])) + b'}')
# AKASEC{be_on_the_right_side_of_history_free_palestine}