Skip to content

Instantly share code, notes, and snippets.

@AndyNovo AndyNovo/algy.py Secret
Last active Mar 6, 2019

Embed
What would you like to do?
# 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()
d2dcd257d1a90ea0a067a2dbcfa246a2dbcfe7bca2db04a2a0b3d2a2cf0e6b4bc787cf8d3ea23e87048ed0a052
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.