题目描述:
6ac66ed89ef9654cf25eb88c21f4ecd0是flag的MD5码,(格式为ctf{XXX_XXXXXXXXXXX_XXXXX})由一个0-1000的数字,下划线,纽约的一个区,下划线,一个10000-15000的数字构成。
直接暴力解。。。代码:
using System;
using System.Security.Cryptography;
public class hebin
{
public static string GetMD5(string myString){
MD5 md5=new MD5CryptoServiceProvider();
byte[] fromData=System.Text.Encoding.Unicode.GetBytes(myString);
byte[] targetData=md5.ComputeHash(fromData);
string byte2String=null;
for(int i=0;i<targetData.Length;i++){
byte2String+=targetData[i].ToString("x");
}
return byte2String;
}
public static void Main()
{
string[] space={"thebronx","brooklyn","manhattan","queens","richmond","statenisland"};
string str=string.Empty;
int flag=0;
for(int i=0;i<=1000;i++){
for(int j=0;j<6;j++){
for(int k=10000;k<=15000;k++){
str="ctf{";
if(i<10) str+="00";
else if(i<100) str+="0";
str=str+i+"_"+space[j]+"_"+k+"}";
if(GetMD5(str)=="6ac66ed89ef9654cf25eb88c21f4ecd0"){
flag=1;break;
}
}
if(flag==1) break;
}
if(flag==1) break;
}
Console.WriteLine(str);
}
}
得到ctf{345_manhattan_10282},提交,通过!