如下所示:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
def translationCipher(msg,key): result = [""] * key for i in range (key): #把每一列元素按照顺序相加组成新的字符序列 pointer = i while i< len (msg): result[pointer] + = msg[i] i + = key return ''.join(result) def main(): if __name__ = = "__main__" : main() |
以上这篇python实现换位加密算法的示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。
原文链接:https://blog.csdn.net/CosmopolitanMe/article/details/72905433