换位加密法
2017-01-13 本文已影响0人
鹿生鲜
换位加密法原理是搞乱消息符号的顺序,使原来的消息不可读。
以「Our beloved Republic is in the hands of madmen.」,key=8为例:

将明文以8个行排列,再以由上至下,由左往右的方法读出密文:「ovbiamuelnnardi dd ctsm br h eeeieonlps f.ou h 」(其实就按8取余,依次排列)
换位加密法Python代码:


其中RealtranspositionEncrypt摘自《Hacking Secret Ciphers with Python》,这是一本非常不错的python入门教材,特别是跟密码学结合在一起,寓教于乐。你可以在以下网站上免费阅读:http://inventwithpython.com