Created
August 23, 2021 12:02
-
-
Save GordonOus/cc1f3eced2b996bf15893ee2ef3d2431 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gmpy2 | |
from Crypto.Util.number import long_to_bytes, bytes_to_long | |
from binascii import unhexlify | |
flag = open('output.txt','r').read().strip().split(' ')[1] | |
ciphertext = bytes_to_long(flag) | |
e = 3 | |
#Fist method of getting cube root of ciphertext | |
gmpy2.get_context().precision = 4096 | |
m = long_to_bytes(round(gmpy2.root(ct,e))).decode() | |
#second method of using the log to base10: 10 ** log(ct)/e | |
m2 = long_to_bytes(pow(10,gmpy2.log10(ct)/e)) | |
print(f'{m}\n{m2}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment