标签:ini rap UNC 其它 and case you code swt
题目: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()
wechall->Crypto - Digraphs writeup
标签:ini rap UNC 其它 and case you code swt
原文地址:https://blog.51cto.com/whbill/2493904