分析
cipher.txt内容如下
1 | Ld hcrakewcfaxr, f hofjjlhfo hlaxuc lj f krau ev hlaxuc kxfk zfj tjui xljkeclhfoor gtk dez xfj vfooud, vec kxu pejk afck, ldke iljtju. Ld hedkcfjk ke peiucd hcrakewcfaxlh foweclkxpj, pejk hofjjlhfo hlaxucj hfd gu acfhklhfoor hepatkui fdi jeoyui gr xfdi. Xezuyuc, OrmkO3vydJCoe2qyNLmcN2qlpJXnM3SxM2Xke3q9 kxur fcu foje tjtfoor yucr jlpaou ke gcufn zlkx peiucd kuhxdeoewr. Kxu kucp ldhotiuj kxu jlpaou jrjkupj tjui jldhu Wcuun fdi Cepfd klpuj, kxu uofgecfku Cudfljjfdhu hlaxucj, Zecoi Zfc LL hcrakewcfaxr jthx fj kxu Udlwpf pfhxldu fdi guredi. F btlhn gcezd veq mtpa eyuc kxu ofsr iew. |
推测是移位的密码,使用WinCrypto
分析得到(也可以使用quip在线分析并修复)
1 | In cryptography, a classical cipher is a type of cipher that was used historically but now has fallen, for the most part, into disuse. In contrast to modern cryptographic algorithms, most classical ciphers can be practically computed and solved by hand. However, LyjtL3fvnSRlo2xvKIjrK2ximSHkJ3ZhJ2Hto3x9 they are also usually very simple to break with modern technology. The term includes the simple systems used since Greek and Roman times, the elaborate Renaissance ciphers, World War II cryptography such as the Enigma machine and beyond. A quick brown fox jump over the lazy dog. |
发现该句子其实来源于英文维基百科的经典加密(Classical cipher)
发现最后一句话其实就是A quick brown fox jumps over the lazy dog.
(包含26个字母的最短句子)并去掉s
由此可以得到对照表然后恢复(当然使用WinCrypto
就直接是这个字符串了)
所以可以得到原本的字符是LyjtL3fvnSRlo2xvKIjrK2ximSHkJ3ZhJ2Hto3x9
解密
直接解base64发现行不通
移位爆破
得到ZmxhZ3tjbGFzc2ljYWxfY2lwaGVyX3NvX2Vhc3l9
是可以解的
爆破代码
1 | def toAlpha(c,i): |
在encrypt
函数中加上base64解密代码即可爆破
增加代码
1 | s = str(base64.b64decode(string_new)) |