Skip to content

Instantly share code, notes, and snippets.

@bascoe10
Last active May 8, 2020 03:31
def read_file(filename):
content = []
with open(filename) as f:
content= list(f.read())
return content
def main():
plaintext = read_file('check.txt')
ciphertext = read_file('out.txt')
plaintext_intlist = list(map(lambda x: ord(x), list(plaintext)))
ciphertext_intlist = list(map(lambda x: ord(x), list(ciphertext)))
key = "".join(list(map(lambda x: chr(x[0]-x[1]), zip(ciphertext_intlist,plaintext_intlist))))
print(key)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment