note 40587 modified in function.array-rand by vrana

From: Date: Tue, 17 Aug 2004 14:48:33 +0000
Subject: note 40587 modified in function.array-rand by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-80048@lists.php.net to get a copy of this message
Another array based password generator, this one is a port from the python mailman version. this generates slightly predictable but human readable passwords that people can remember output passwords are for example "rikanumi" <?php // port of mailman version function MakeRandomPassword($length=6) { $_vowels = array ('a', 'e', 'i', 'o', 'u'); $_consonants = array ('b', 'c', 'd', 'f', 'g', 'h', 'k', 'm', 'n','p', 'r', 's', 't', 'v', 'w', 'x', 'z'); $_syllables = array (); foreach ($_vowels as $v) { foreach ($_consonants as $c) { array_push($_syllables,"$c$v"); array_push($_syllables,"$v$c"); } } for ( $i=0;$i<=($length/2);$i++) $newpass=$newpass.$_syllables[array_rand($_syllables) ]; return $newpass; ?> } --was-- Another array based password generator, this one is a port from the python mailman version. this generates slightly predictable but human readable passwords that people can remember output passwords are for example "rikanumi" // port of mailman version function MakeRandomPassword($length=6) { $_vowels = array ('a', 'e', 'i', 'o', 'u'); $_consonants = array ('b', 'c', 'd', 'f', 'g', 'h', 'k', 'm', 'n','p', 'r', 's', 't', 'v', 'w', 'x', 'z'); $_syllables = array (); foreach ($_vowels as $v) { foreach ($_consonants as $c) { array_push($_syllables,"$c$v"); array_push($_syllables,"$v$c"); } } for ( $i=0;$i<=($length/2);$i++) $newpass=$newpass.$_syllables[array_rand($_syllables) ]; return $newpass; } http://php.net/manual/en/function.array-rand.php

« previous php.notes (#80048) next »