攻防世界-密碼學-Decrypt-the-Message


1. 題目信息

題目要求我們解密附件中的信息;打開附件,里面是一首詩,最后給出需要解密的信息。

2. 分析

此題考察Poem加密;舉例說明加密過程。
詩:for my purpose holds to sail beyond the sunset, and the baths of all the western stars until I die.
明文:We have run out of cigars, situation desperate.
從詩中選擇5個詞for,sail,all,stars,die,將這些詞中的每個字母排序(相同的不合並),即

f o r s a i l a l
6 12 13 15 1 7 9 2 10
l s t a r s d i e
11 16 18 3 14 17 4 8 5

上表共有18個字母,將明文以18個字母一組分成若干行,最后一行未滿之處用a,b,...進行填充,即

1 2 3 4 5 6 7 8 9
w e h a v e r u n
r s s i t u a t i
t e a b c d e f g
10 11 12 13 14 15 16 17 18
o u t o f c i g a
o n d e s p e r a
h i j k l m n o p

再根據第一個表將各列置換,即eud tdj ...,最后連接起來生成密文。

破解的思路就是從詩中窮舉各種取詞情況,然后進行解密,然后選擇可讀的“明文”,已有人寫好破解的工具

3.解題

將詩與密文分別存為poem.txt,cip.txt並移到與poemcode.py同目錄下,使用工具破解:

$ python poemcode.py poem.txt cip.txt
...
ifytuothikcrnyptorapyisheansnweroyoturprbletheyoulodnotnowkwhatourrobemiuasbcdfgheijklnoprst
ifyouthinkcryptographyistheanswertoyourproblemthenyoudonotknowwhatyourproblemisabcdefghijklmnopqrstu
pakprictiyorhftyselorohyphurbeewterunhwooaywtooonrbpofjhsgkeilncmbrt
...

中間的為明文。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM