一、培根密码加密方式

培根密码,这种密码本质上是用二进制数设计的,没有用通常的0和1,而是用a和b来表示。加密时,明文中的每个字母都会转换成一组五个英文字母。其转换依靠下表:

二、附加解密python脚本如下:

当然是别的大佬写的脚本,以供借鉴

#!/usr/正直的饼干/python# -*- coding: utf-8 -*-import realphabet = [‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’,’j’,’k’,’l’,’m’,’n’,’o’,’p’,’q’,’r’,’s’,’t’,’u’,’v’,’w’,’x’,’y’,’z’]first_cipher = [“aaaaa”,”aaaab”,”aaaba”,”aaabb”,”aabaa”,”aabab”,”aabba”,”aabbb”,”abaaa”,”abaab”,”ababa”,”ababb”,”abbaa”,”abbab”,”abbba”,”abbbb”,”baaaa”,”baaab”,”baaba”,”baabb”,”babaa”,”babab”,”babba”,”babbb”,”bbaaa”,”bbaab”]second_cipher = [“aaaaa”,”aaaab”,”aaaba”,”aaabb”,”aabaa”,”aabab”,”aabba”,”aabbb”,”abaaa”,”abaaa”,”abaab”,”ababa”,”ababb”,”abbaa”,”abbab”,”abbba”,”abbbb”,”baaaa”,”baaab”,”baaba”,”baabb”,”baabb”,”babaa”,”babab”,”babba”,”babbb”]def encode(): string = raw_input(“please input string to encode:\n”) e_string1 = “” e_string2 = “” for index in string: for i in range(0,26): if index == alphabet[i]: e_string1 += first_cipher[i] e_string2 += second_cipher[i] break print “first encode method result is:\n”+e_string1 print “second encode method result is:\n”+e_string2 returndef decode(): e_string = raw_input(“please input string to decode:\n”) e_array = re.findall(“.{5}”,e_string) d_string1 = “” d_string2 = “” for index in e_array: for i in range(0,26): if 美国高防vps index == first_cipher[i]: d_string1 += alphabet[i] if index == second_cipher[i]: d_string2 += alphabet[i] print “first decode method result is:\n”+d_string1 print “second decode method result is:\n”+d_string2 returnif __name__ == ‘__main__’: while True: print “\t*******Bacon Encode_Decode System*******” print “input should be lowercase,cipher just include a b” print “1.encode\n2.decode\n3.exit” s_number = raw_input(“please input number to choose\n”) if s_number == “1”: encode() raw_input() elif s_number == “2”: decode() raw_input() elif s_number == “3”: break else: continue

小白的我还只能用工具来解密添加链接描述