Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- encoded = list(open('p059_cipher.txt'))[0]
- reformat, stringName = [], ""
- for a in encoded:
- if a == ",":
- reformat.append(int(stringName))
- stringName = ""
- continue
- stringName += a
- possibleEntries, possibleKeys = [], []
- for b in range(97, 123):
- for c in range(97, 123):
- for d in range(97, 123):
- key, index, decrypted = [b, c, d], 0, []
- for e in reformat:
- selectDecryption = (key[index] ^ e)
- if selectDecryption <= 31:
- break
- if selectDecryption == 127:
- break
- decrypted.append(selectDecryption)
- if index == 2:
- index = 0
- continue
- index += 1
- if len(decrypted) != len(reformat):
- continue
- possibleEntries.append(decrypted)
- possibleKeys.append(key)
- filtered = []
- for f in possibleEntries:
- if f[0] == 40:
- filtered.append(f)
- if f[0] == 42:
- filtered.append(f)
- refiltered = []
- for g in filtered:
- readable = [chr(h) for h in g]
- refiltered.append(readable)
- for i in refiltered:
- if i[1] == "T":
- if i[2] == "h":
- if i[3] == "e":
- answer = i
- answer = [ord(j) for j in answer]
- total = 0
- for k in answer:
- total += k
- total += 46
- print(total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement