wechall->Crypto - Digraphs writeup

网友投稿 347 2022-10-24


wechall->Crypto - Digraphs writeup

题目:This time I am using a digraph crypto scheme to encrypt one letter into two characters.With only 26 different letters I am able to encrypt up to 26*26 different characters.The big problem again is sharing the key, but the cipher is easily broken anyway.The message is in the current language, is written with correct case and punctuation. There are no line breaks.

Good luck!

密文:cqzvftzijojqsweczyjqswtuzvftirqc wszvec hwivrajotdbsswivhw swcptuir loivirirjqziiv irecraraivirirmheczyzytdqc gyjqir ftzvsw swzvzv hwtumhmhturaeczysw ivtuswcpivjouc kujqir tuswxr gyivzyzyuc zizvzvhw ytzvezqc bpftswivjo swcptuir deivtdkuzvjohw jqir irzvzyecswtuzvftaw tuftmhmhftftjojqezezziftqc

#c = 'cqzvftzijojqsweczyjqswtuzvftirqc wszvec hwivrajotdbsswivhw swcptuir loivirirjqziiv irecraraivirirmheczyzytdqc gyjqir ftzvsw swzvzv hwtumhmhturaeczysw ivtuswcpivjouc kujqir tuswxr gyivzyzyuc zizvzvhw ytzvezqc bpftswivjo swcptuir deivtdkuzvjohw jqir irzvzyecswtuzvftaw tuftmhmhftftjojqezezziftqc' c = "aodrpqucxxrhawzpkyrhawyadrpqrtnf tadrzp zajginxxoigiawjgza awzeyart dpjgrtrtrhucjg rtzpininjgrtrtmkzpkykyoinf zhrhrt pqdraw awdrdr zayamkmkyainzpkyaw jgyaawzejgxxwe cgrhrt yaawfq zhjgkykywe ucdrdrza cfdrlpnf xkpqawjgxx awzeyart dejgoicgdrxxza rhrt rtdrkyzpawyadrpqrj ucrhmkmkdrmkdrucdpyazertnf" dic = {} def get_c_double_chars(): c_dic = [] i = 0 while i < len(c): if c[i] == ' ': i += 1 #jump the space continue if c_dic.count(c[i:i+2]) == 0: c_dic.append(c[i:i+2]) i += 2 #dic = {c_dic[i]:chr(ord('a')+i) for i in range(len(c_dic))} dic.update({c_dic[i]:'?' for i in range(len(c_dic))}) #print(c_dic) print(dic) get_c_double_chars() def guess_dic(c_word,m_word): #密文单词 c_word, 猜测的明文单词m_word for i in range(len(m_word)): j = i * 2 dic[c_word[j:j+2]] = m_word[i] print(dic) def transf_c(): m = '' i = 0 while i < len(c): if c[i] == ' ': m += ' ' i += 1 continue m += dic[c[i:i+2]] i += 2 print(c) print(m) ''' #猜测,第一个单词'cqzvftzijojqsweczyjqswtuzvftirqc'是 'congratulations!' 结果:congratulations! ?ou ???r??t?? t?is ??ssag? su???ss?ull?! ?as not too ?i??i?ult ?it??r? ?as it? ??ll? goo? ?o?! ?nt?r t?is ????or? as solution? ga??o?og?i?s! 然后猜测其它单词 guess_list = [ ['cqzvftzijojqsweczyjqswtuzvftirqc','congratulations!'], ['irzvzyecswtuzvftaw','solution'], ['wszvec','you'], ['irecraraivirirmheczyzytdqc','successfull'], ['hwivrajotdbsswivhw','decrypted'], ['swcptuir','this'], ['loivirirjqziiv','message'], ['gyjqir','was'], ['ytzvezqc','job'], ] ''' guess_list = [ ['aodrpqucxxrhawzpkyrhawyadrpqrtnf','congratulations!'], ] for pair in guess_list: guess_dic(pair[0],pair[1]) transf_c()


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:计算机网络6:数据在两台计算机之间是怎样传输的?
下一篇:Java使用5个线程计算数组之和
相关文章

 发表评论

暂时没有评论,来抢沙发吧~