예제 #1
0
파일: adfgx.py 프로젝트: tompko/praxis
def decrypt(cipher, polybius, keyword):
    untrans = untranspose(cipher, keyword)

    trans = {}
    for (val, key) in zip(polybius, itertools.product("ADFGX", repeat=2)):
        key = key[0] + key[1]
        trans[key] = val
    
    groups = [untrans[2*i:2*i+2] for i in range(len(untrans) / 2)]

    return "".join([trans[g] for g in groups])
예제 #2
0
def decrypt(cipher, key1, key2):
    return untranspose(untranspose(cipher, key2), key1)