Created
July 12, 2020 07:40
-
-
Save yytasbag/9ab6c7d4a6e565e6fd29221fff1daf08 to your computer and use it in GitHub Desktop.
TSGCTF 2020 beginner crypto
This file contains 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
from Crypto.Util.number import * | |
# calculate the solution to 2^10000 * x = 1002773875431658367671665822006771085816631054109509173556585546508965236428620487083647585179992085437922318783218149808537210712780660412301729655917441546549321914516504576 mod 5^174 | |
R.<x> = PolynomialRing(Integers(5^174), implementation='NTL') | |
f = 2^10000 * x - 1002773875431658367671665822006771085816631054109509173556585546508965236428620487083647585179992085437922318783218149808537210712780660412301729655917441546549321914516504576 | |
print(f.monic()) | |
flag = R(-40911366519048706766028794026595817244329662170458953600729420435667708075268681595360226681630085247360526719063455282924) | |
print(flag) | |
flag = long_to_bytes(850582076141850204917088272646087112157789081182432304925852879338520690155230258866308530234671754970789752036398232701) | |
print(flag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment