How to encrypt and decrypt the Transportation Cipher with python(Ⅰ)

def main():
    myMessage = 'Common sense is not so common.'
    myKey=8

    ciphertext=encryptMessage(myKey,myMessage)

    print(ciphertext+'|')

def encryptMessage(key,message):
    ciphertext=['']*key

    for col in range(key):
        pointer=col

        while pointer<len(message):
            ciphertext[col]+=message[pointer]
            pointer+=key

    return ''.join(ciphertext)

if __name__=='__main__':
    main()

你可能感兴趣的:(密码学,python)