Re: Creating all key combinations passwords

From: Date: Sun, 20 May 2007 15:44:31 +0000
Subject: Re: Creating all key combinations passwords
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-43626@lists.php.net to get a copy of this message
Lasitha Alawatta wrote:
I’m going to create all key combinations; simple-letter passwords and store those in to MySql DB. Using = a-z (simple letters) Password length = 6 Number of possibilities = 26 x 26 x 26 x 26 x 26 x 26 = 308,915,776 This is my code: <?php
      for($i=0;$i< 500000000;$i++){
            $arrPwd[] = createPwd();
      }
      $arrUniqueData = array_unique($arrPwd);
      foreach($arrUniqueData as $key=>$val){
            // Inserting to DB
}
      function createPwd() {
            $lower = "abcdefghijklmnopqrstuvwxyz";
            $seed_length += 26;
            $seed .= $lower;
                       for($x=1;$x<=6;$x++){
                  $ strPwd.= $seed{rand(0,$seed_length-1)};
            }
            return($strPwd);
      }
?> What is the easiest way to get my output? 1. Because above code will stuck the PC (for($i=0;$i< 500000000;$i++){). 2. I use 500000000 instead of 308915776, because createPwd() function
      will duplicating the password.
Suggesting, comments, code samples are highly appreciate.
The only reason I can see to do such a thing is to build a brute-force password cracker, and seeing as you're not smart enough to realise that you can do so incrementally instead of randomly, I don't see much reason to help you. Enjoy. -Stut

« previous php.db (#43626) next »