#native_company# #native_desc#


By Benjamin Smith
on November 13, 2001

Version: 1.02

Type: Function

Category: Other

License: GNU General Public License

Description: This function seeks to mimic the mkpasswd script that comes with the ‘expect’ progrom
found at http://expect.nist.gov/ . A random password is generated using the the parameters specified.

You can specify the length of the password, the minimum number of alphabets, numbers and symbols it can have, exclude character types, specify allowable symbols, letter case.

list($usec,$sec)=explode(" ",microtime());
mt_srand($sec * $usec);
function MkPassword($length=10)
 $possible='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefhijklmnopqrstuvwxyz098765432$              $return='';
 for ($i=0; $i<$length; $i++)
   $key=mt_rand(0, strlen($possible)-1);
 return $return;