图片隐写解密
2017bath这张图片有一些文字片段,可能简单加密了,是某人说的,此人的姓名是什么?
hint:hex editor
刚开始根据提示用hex editor打开这张照片,设置为Hex 16进制查看,字符集设为utf-8:
果然在文件中看到了Rail-Fence.txt,这时候就怀疑它是不是在图片里放了txt文本文件,这时想起曾做过一道将文件隐藏在图片中的题。将文件后缀名改为.zip文件,尝试用压缩软件打开图片,果然发现了一个隐藏的文件:
打开txt文件,得到一长串乱序的字符:
应该是经过某种加密的,注意到文件名是Rail-Fence:栅栏加密算法。接下来就是编程解密的过程:
代码如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s="CrudreasrsheheanaulhfouCmhlaopiaeifltouermrtdpiyeCntpmafhnpbgmbaoagspeuteuwtecwokpetwutileolctnreoicottievhetepriogoseIretodaiithgottfeorhersnueualtebtfamtnseetehrnieipooilrshashyhsrmttmanariaictntgutdeeonmotaudeowuselctnfeoghrtsbaCrgarhtbprthcirarQktodbeatees";
int num,len=s.length();
cout<<"待解密的密文字符串是:"<<s<<endl;
cout<<"长度为:"<<len<<endl;
cout<<"请输入栅栏密码解密每个分组的长度"<<endl;
///从2开始递增
cin>>num;
int ary=ceil(len/(double)num);
cout<<"按照分组长度解密后的明文字符串长度为:"<<ary<<endl;
cout<<"解密后的明文字符串为:";
for(int i=0;i<ary;i++)
{
for(int j=0;j<num;j++)
{
cout<<s[ary*j+i];
}
}
return 0;
}
运行时,先假定每组2个字符,解密后发现还是乱序:
故慢慢加大每组字符的长度,直到数字为9的时候,发现解密后的字符串是可以识别的,解密成功:
解密后的文本:Cpp is a horrible language.It made more horrible by the fact that a lot of substandard programmers use it to the point where its much much easier to generate total and utter crap with it.Quite frankly even if the choice of C were to do nothing but keep the Cpp programmers out that in itself would be a huge reason to use C.
通过网络查询到上面这段话出自Linus Torvalds(“Linux之父”,Linux核心的创作者),故本题的答案应该是Linus Torvalds。