-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel_8.py
27 lines (16 loc) · 1.48 KB
/
level_8.py
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
# -*- coding: utf-8 -*-
import gmpy2
import binascii
"""
OK no more extra bits of information for you. Good luck trying to solve this one. Just a public key and a ciphertext so should be impossible.
"""
n = 23516695565660963250242846975094031309572348962900032827958534374248114661507001374384417953124930587796472484525315334716723068326965228898857733318407681656604325744994115789416012096318656034667361976251100005599211469354510367804546831680730445574797161330145320706346512982316782618118878428893337849886890813813050423818145497040676697510093220374542784895778086554812954376689653727580227087363619223145837820593375994747273662064715654881379557354513619477314410917942381406981452545764657853425675230343749326640073923166795823683203941972393206970228647854927797483660176460658959810390117898333516129469397
e = 3
c = 145069245024457407970388457302568525045688441508350620445553303097210529802020156842534271527464635050860748816803790910853366771838992303776518246009397475087259557220229739272919078824096942593663260736405547321937692016524108920147672998393440513476061602816076372323775207700936797148289812069641665092971298180210327453380160362030493
# e small exponent attack to solve
# since e is so small, and message likely much smaller than our N, we can easily compute the plaintext by taking the cube root of c
# enc_text = pt^3 mod N
# pt = root(ct,3)
gmpy2.get_context().precision=200000
m = int(gmpy2.root(c,e))
print (binascii.unhexlify(hex(int(m))[2:]).decode('utf-8'))