Or is there a software to auto generate random passwords?
Just build a string of random a-z, A-Z, 0-9 (or whatever you want) up to the desired length. Here's an example in PHP:
function generatePassword($length = 8) {
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$count = mb_strlen($chars);
for ($i = 0, $result = ''; $i < $length; $i++) {
$index = rand(0, $count - 1);
$result .= mb_substr($chars, $index, 1);
}
return $result;
}
To optimize, you can define $chars as a static variable or constant in the method (or parent class) if you'll be calling this function many times during a single execution.
I actually wrote myself two libraries that I released under GPL V2.0 for generating passwords of any given strength, feel free to check them out and use them if you like.
Www.projects.semanticalsyntax.com Source is avaliable for both.
$password = hash('sha512', rand());
Shouldn't be too hard to remember. This might be easier to remember though:
$password = substr(hash('sha512',rand()),0,12); // Reduces the size to 12 chars
There's only 16 possible characters being used, but that's still 16^12 possible passwords (at 300,000 passwords/second, it would take 29 years to crack).
I want to play the game. The simplest way would be to do:
function rand_passwd( $length = 8, $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' ) {
return substr( str_shuffle( $chars ), 0, $length );
}
This is pretty much just a modification of the first answer. Specify the characters you want in the second parameters and the length of the password in the first.
Here's a simple solution. It will contain lowercase letters and numbers.
substr(str_shuffle(strtolower(sha1(rand() . time() . "my salt string"))),0, $PASSWORD_LENGTH);
Here's A stronger solution randomly generates the character codes in the desired character range for a random length within a desired range.
function generateRandomPassword() {
//Initialize the random password
$password = '';
//Initialize a random desired length
$desired_length = rand(8, 12);
for($length = 0; $length < $desired_length; $length++) {
//Append a random ASCII character (including symbols)
$password .= chr(rand(32, 126));
}
return $password;
}
I wrote one some time ago. It's not random though. It generates passwords based on hashes of inputs you choose. It might be more useful than a truly random password generator. --> http://trashb.in/pwgen
The implementation of the password generation is in Javascript, so it doesn't post any of your details to me. Feel free to use it and/or grab the code.
You could just use PEAR's Text_Password package - it supports quite a few algorithms for generating them; and frees up your time to go onto something else.