Help - Search - Member List - Calendar
Full Version: password generation
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
Mark D Smith
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
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
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
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
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
"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
"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.


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.