-
-
Save AndyNovo/b9b303337b04f38f092766e19715d036 to your computer and use it in GitHub Desktop.
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
# Python 2.7 | |
from Crypto.Util.number import * | |
f=file('flag','r') | |
theflag = f.read() | |
f.close() | |
p=257 | |
key = getRandomRange(3,p-3) | |
def encrypt(pt, key, p): | |
bytearray=[] | |
for ltr in pt: | |
bytearray.append(key*inverse(ord(ltr), p) % p) | |
return "".join(map(chr, bytearray)) | |
ct = encrypt(theflag.strip(), key, p) | |
f=file('ciphertext','w') | |
f.write(ct.encode('hex')) | |
f.close() |
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
d2dcd257d1a90ea0a067a2dbcfa246a2dbcfe7bca2db04a2a0b3d2a2cf0e6b4bc787cf8d3ea23e87048ed0a052 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment