Skip to content

Instantly share code, notes, and snippets.

@bascoe10
Last active May 8, 2020 03:31
Show Gist options
  • Save bascoe10/45422021877e4e53d0dd9065af9653a3 to your computer and use it in GitHub Desktop.
Save bascoe10/45422021877e4e53d0dd9065af9653a3 to your computer and use it in GitHub Desktop.
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