1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import itertools
key = [] cipher = "ilnllliiikkninlekile"
for i in itertools.permutations('ilnke', 5): key.append(''.join(i))
for now_key in key: solve_c = "" res = "" for now_c in cipher: solve_c += str(now_key.index(now_c)) for i in range(0,len(solve_c),2): now_ascii = int(solve_c[i])*5+int(solve_c[i+1])+97 if now_ascii>ord('i'): now_ascii+=1 res += chr(now_ascii) if "flag" in res: print (now_key,res)
|