Skip to content

Instantly share code, notes, and snippets.

@Kaivosukeltaja Kaivosukeltaja/m2m.py Secret
Created Nov 18, 2014

Embed
What would you like to do?
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
You can’t perform that action at this time.