穷举法运算

来源:互联网 发布:历史类书籍 知乎 编辑:程序博客网 时间: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&amp;dt=1183890684015&amp;lmt=1183890684&amp;format=468x60_as&amp;output=html&amp;correlator=1183890684000&amp;url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&amp;ad_type=text_image&amp;ui=rc%3A0&amp;cc=100&amp;flash=9&amp;u_h=768&amp;u_w=1024&amp;u_ah=738&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;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&amp;dt=1183890684015&amp;lmt=1183890684&amp;format=468x60_as&amp;output=html&amp;correlator=1183890684000&amp;url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&amp;ad_type=text_image&amp;ui=rc%3A0&amp;cc=100&amp;flash=9&amp;u_h=768&amp;u_w=1024&amp;u_ah=738&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency"></iframe>

原创粉丝点击