-
-
Save Kaivosukeltaja/1f1921dba9e3d3c9f2a6 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
n = int(input("Please enter random seed: ")) | |
message = list(raw_input("Please enter message(s): ")) | |
alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") | |
sequence = "" | |
decoded = "" | |
while len(sequence) < 1000: | |
n = int(str(n * n).replace("0","1")[-4:-1]) | |
sequence = sequence + str(n) | |
seqindex = 0 | |
for c in message: | |
if c in alphabet: | |
decoded += alphabet[(alphabet.index(c)-int(sequence[seqindex]))%(len(alphabet))] | |
seqindex += 1 | |
else: | |
decoded += c | |
print decoded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment