2023-10-15 19:42:16 +08:00

16 lines
888 B
Python

from flag import flag
from Crypto.Util.number import *
from sympy import nextprime
p = getStrongPrime(512)
q = nextprime(p)
n = p * q
e = 65537
message = bytes_to_long(flag)
cipher = pow(message, e, n)
print('n = ', n)
print('cipher = ', cipher)
'''
n = 119089874014927074688341672884508166875005676500322264758691717600758737133958853429775347698400246542956663932584349274109281162512900740554148968627493442686180696496512753102593837838697028745592258709705875168834908314583594102947493349091661801379830005354833653565157987808629144151353148601181998243399
cipher = 117095409962662175082351896808794751507022710425611245694723238077959955609489552866653772250169627679450018400780468195080203740614508425379908667955368095074633690882446901510961333353751345467769557765781287285368700648236247094896521401160296460446518097963846290488354458277094831166588801569124630935182
'''