Last active
May 8, 2020 03:31
-
-
Save bascoe10/45422021877e4e53d0dd9065af9653a3 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
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