Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for AMSCO Cipher by Moff
def decode_amsco(cipher, key):
key = list(map(int, str(key)))
m = [[] for _ in key]
i = 0
while i < len(cipher):
for j in range(len(key)):
a, b = j % 2, len(m[j]) % 2
if a + b == 1 and a * b == 0:
if i + 2 <= len(cipher):
m[j].append('--')
i += 2
elif i + 1 <= len(cipher):
m[j].append('-')
i += 1
else:
if i + 1 <= len(cipher):
m[j].append('-')
i += 1
for i in range(len(key)):
col = m[key.index(i+1)]
for j in range(len(col)):
d = len(col[j])
col[j], cipher = cipher[:d], cipher[d:]
return ''.join([row[i] for i in range(max(map(len, m)))
for row in m if i < len(row)])
Aug. 8, 2015