Mark D Smith
Jun 10 2005, 07:18 AM
Hi
i am using a pear addition Text_Password
$pass = Text_Password::create($length = 8, $type = 'unpronounceable',$chars
= '');
problem is $pass contains some chars that are not A-Za-z 0-9, i have seen
underscores & accented chars returned.
is there a better way to generate an 8 char password for users?. I will be
using crypt to put in mysql database.
Mark
bebbet
Jun 10 2005, 11:34 AM
function createpass($chars) {
$array ("","0","1" etc.....
while ($i != ($chars+1)) {
$pass .= rand(1,36);
$i++;
return $pass;
}
}
then use it like this:
createpass([length chars]);
--
bebbet
Geoff Berrow
Jun 10 2005, 12:46 PM
I noticed that Message-ID:
<33c3f$42a988df$d52e9932$[Email Removed]> from bebbet contained the
following:
QUOTE |
function createpass($chars) { $array ("","0","1" etc..... while ($i != ($chars+1)) { $pass .= rand(1,36); $i++; return $pass; } }
then use it like this:
createpass([length chars]);
|
I was asked to write a random password generator that created up to 2000
memorable passwords. I used an array of syllables
www.ckdog.co.uk/dev/randpass.php
Of course you have to be a bit careful you don't use syllables that can
be combined in - ah - unfortunate combinations.
On the other hand you might, just for fun, deliberately do that. I'd
probably name such a file randpasrude dot php - if it existed. ;-)
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow
Jun 10 2005, 09:00 PM
I noticed that Message-ID: <[Email Removed]>
from Geoff Berrow contained the following:
QUOTE |
On the other hand you might, just for fun, deliberately do that. I'd probably name such a file randpasrude dot php - if it existed. ;-) or even randpassrude.php |
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Geoff Berrow
Jun 10 2005, 09:01 PM
I noticed that Message-ID: <[Email Removed]>
from Geoff Berrow contained the following:
QUOTE |
I was asked to write a random password generator that created up to 2000 memorable passwords. I used an array of syllables www.ckdog.co.uk/dev/randpass.php
|
Grrr. It's been one of those days...
http://www.ckdog.co.uk/php/test/randpass.php--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
Mark D Smith
Jun 11 2005, 08:38 AM
"bebbet" <[Email Removed]> wrote in message
news:33c3f$42a988df$d52e9932$[Email Removed]...
QUOTE |
function createpass($chars) { $array ("","0","1" etc..... while ($i != ($chars+1)) { $pass .= rand(1,36); $i++; return $pass; } }
then use it like this:
createpass([length chars]);
-- bebbet
Hi |
a little buggy!
i added
$chrs = array("","A","B",
and fixed the while loop
while ($i != ($chars+1)) {
$pass .= $chrs[rand(1,36)];
$i++;
}
return $pass;
}
now works just fine.
Mark
Xenophaw
Jun 11 2005, 12:26 PM
"Mark D Smith" <[Email Removed]> wrote:
QUOTE |
Hi
i am using a pear addition Text_Password
$pass = Text_Password::create($length = 8, $type = 'unpronounceable',$chars = '');
problem is $pass contains some chars that are not A-Za-z 0-9, i have seen underscores & accented chars returned. is there a better way to generate an 8 char password for users?. I will be using crypt to put in mysql database.
Mark
|
If the lengh is not a problem, I would translate the result from
Text_Password::create() like this base_convert(bin2hex($pass), 16, 36).
In this way you would obtain just characters in a-z 0-9, but the password
lenght would become 12 characters. As you already get an unpronunciable
password, for the user would not be bothering to have to remember 4
characters more.
I hope this will help you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.