Re: Way to generate Passwords
| From: | Stephan Ahonen | Date: | Fri, 02 Mar 2001 04:21:10 +0000 |
| Subject: | Re: Way to generate Passwords | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42281@lists.php.net to get a copy of this message | ||
> function passwort($laenge)
> {
> $allowed =
> "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890:-+=";
> $allowed_length = strlen($allowed);
>
> $i=0;
> $pw = "";
>
> while ($i<$laenge) {
> $pos = rand(0,$allowed_length);
> $pw.= substr($allowed,$pos,1);
> $i++;
> }
> return $pw;
> }
>
> My questions is, if this is a good or bad way?
It's a whole lot better than using real words. As long as you encrypt the
passwords using a good one-way hash when you store them on the server, you
should be fine.
Sig for a Day
Stephan Ahonen, ICQ 491101
"That's very funny Scotty, now beam down my clothes!"
Come back tomorrow for a different sig!
Backspace a single "s" to reply by email