Home > Archive > PHP Language > June 2005 > password generation
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
password generation
|
|
| Mark D Smith 2005-06-10, 8:55 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 2005-06-10, 3:56 pm |
| 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 2005-06-10, 3:56 pm |
| I noticed that Message-ID:
<33c3f$42a988df$d52e9932$13341@news.chello.nl> from bebbet contained the
following:
>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
0011011010110110010001101111011001110010
11
1001100011011011110010111001110101011010
11
| |
| Geoff Berrow 2005-06-10, 8:55 pm |
| I noticed that Message-ID: <u26ja1hqj7jjcm7s5t4vbjij91itqcdvam@4ax.com>
from Geoff Berrow contained the following:
>
>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
0011011010110110010001101111011001110010
11
1001100011011011110010111001110101011010
11
| |
| Geoff Berrow 2005-06-10, 8:55 pm |
| I noticed that Message-ID: <u26ja1hqj7jjcm7s5t4vbjij91itqcdvam@4ax.com>
from Geoff Berrow contained the following:
>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
0011011010110110010001101111011001110010
11
1001100011011011110010111001110101011010
11
| |
| Mark D Smith 2005-06-11, 8:55 am |
| "bebbet" <bebbet@bebbet.nl> wrote in message
news:33c3f$42a988df$d52e9932$13341@news.chello.nl...
> 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 2005-06-11, 3:55 pm |
|
"Mark D Smith" <usenet@NOSPAM.obantec.net> wrote:
> 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.
|
|
|
|
|