Creating all key combinations passwords

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

Hi All,

 

 

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.

 

Thanks in advance,

Lasitha.

 

 

 




DOTW DISCLAIMER:

This e-mail and any attachments are strictly confidential and intended for the addressee only. If you are not the named addressee you must not disclose, copy or take
any action in reliance of this transmission and you should notify us as soon as possible. If you have received it in error, please contact the message sender immediately.
This e-mail and any attachments are believed to be free from viruses but it is your responsibility to carry out all necessary virus checks and DOTW accepts no liability
in connection therewith. 

This e-mail and all other electronic (including voice) communications from the sender's company are for informational purposes only.  No such communication is intended
by the sender to constitute either an electronic record or an electronic signature or to constitute any agreement by the sender to conduct a transaction by electronic means.
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux