Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cipher(input):
- cryptic = dict()
- infile = open(input, "r")
- for line in infile:
- whole = line.split()
- parts = whole[0]
- key = whole[1]
- cryptic[parts] = key
- infile.close()
- return cryptic
- def replaceText(input, cryptic):
- infile = open(input, "r")
- decrypted = ""
- for line in infile:
- for parts in line:
- if parts in cryptic:
- decrypted += cryptic[parts]
- else:
- decrypted += parts
- infile.close()
- key = cipher("key.txt")
- decode = replaceText("encypted.text",key)
- outfile = open("decrypted.txt", "w")
- outfile.write(decode + "\n  ")
- outfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement