穷举法运算
来源:互联网 发布:历史类书籍 知乎 编辑:程序博客网 时间:2024/05/01 06:50
<iframe name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3528650120430763&dt=1183890684015&lmt=1183890684&format=468x60_as&output=html&correlator=1183890684000&url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&ad_type=text_image&ui=rc%3A0&cc=100&flash=9&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"></iframe>
//密码穷举法
string[] chs=new string[]{"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
int count =0;//计算次数
int ndictcount=chs.Length;//密码词典长度
string psw,mima,s;//要生成的密码
psw="";
s="";
mima="micel108abd2134";
int lenmin=mima.Length;
for(int i=0;i<lenmin;i++)//密码长度不知道
{
for(int j=0;j<ndictcount;j++)
{
count+=1;
s=mima[i].ToString();
if(chs[j]==s)
{
psw+=chs[j];
}
}
}
Console.WriteLine("密码为{0},计算次数为{1}",psw,count);
<iframe name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3528650120430763&dt=1183890684015&lmt=1183890684&format=468x60_as&output=html&correlator=1183890684000&url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&ad_type=text_image&ui=rc%3A0&cc=100&flash=9&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"></iframe>