题目信息

题目要求我们解密附件中的信息;打开附件,里面是一首诗,最后给出需要解密的信息。

分析

此题考察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,将这些词中的每个字母排序(相同的不合并),即:

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

上表共有18个字母,将明文以18个字母一组分成若干行,最后一行未满之处用a,b,…进行填充,即
1
2
3
4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
w e h a v e r u n o u t o f c i g a
r s s i t u a t i o n d e s p e r a
t e a b c d e f g h i j k l m n o p

再根据第一个表将各列置换,即eud tdj …,最后连接起来生成密文。

破解的思路就是从诗中穷举各种取词情况,然后进行解密,然后选择可读的“明文”,已有人写好破解的工具

解题

将诗与密文分别存为poem.txt,cip.txt并移到与poemcode.py同目录下,使用工具破解:

1
2
3
4
5
6
$ python poemcode.py poem.txt cip.txt
...
ifytuothikcrnyptorapyisheansnweroyoturprbletheyoulodnotnowkwhatourrobemiuasbcdfgheijklnoprst
ifyouthinkcryptographyistheanswertoyourproblemthenyoudonotknowwhatyourproblemisabcdefghijklmnopqrstu
pakprictiyorhftyselorohyphurbeewterunhwooaywtooonrbpofjhsgkeilncmbrt
...

中间的为明文。