Re: [vchkpw] Generate password in MySQL
Thanks for the replies (Michael and David). Very helpful. Cheers, Jonathan Michael Bowe wrote: - Original Message - From: "Jonathan Viney" <[EMAIL PROTECTED]> Hi all, Can someone tell me how I can generate a password which could be used in the pw_passwd field in MySQL? If possible, I'd like MySQL to generate the password, can anyone give me some pointers? ASP and PHP examples are available via this link : http://www.mail-archive.com/[EMAIL PROTECTED]/msg15037.html Michael.
Re: [vchkpw] Generate password in MySQL
- Original Message - From: "Jonathan Viney" <[EMAIL PROTECTED]> > Hi all, > > Can someone tell me how I can generate a password which could be used in > the pw_passwd field in MySQL? > > If possible, I'd like MySQL to generate the password, can anyone give me > some pointers? ASP and PHP examples are available via this link : http://www.mail-archive.com/[EMAIL PROTECTED]/msg15037.html Michael.
Re: [vchkpw] Generate password in MySQL
On Mon, 2004-04-26 at 11:28, Jonathan Viney wrote: > Hi all, > > Can someone tell me how I can generate a password which could be used in > the pw_passwd field in MySQL? > > If possible, I'd like MySQL to generate the password, can anyone give me > some pointers? > > Cheers, > Jonathan Hi, I don't know if this will really help you, but that's what I use to generate passwords from php. $clearpass = "something"; $crypted = ''; if (mkpasswd3($clearpass, $crypted)) { printf("%s -> %s\n",$clearpass, $crypted); } else echo("Failed to create password"); function randltr() { $retval = 'a'; $rand = rand() % 64; if ($rand < 26) $retval = $rand + 'a'; if ($rand > 25) $retval = $rand - 26 + 'A'; if ($rand > 51) $retval = $rand - 52 + '0'; if ($rand == 62) $retval = ';'; if ($rand == 63) $retval = '.'; return($retval); } function mkpasswd3(&$clearpass, &$crypted) { srand ((double)microtime()*100); $salt = '$1$'; for ($i = 0; $i < 5; $i++) $salt .= randltr(); $salt .= '0'; $crypted = crypt($clearpass, $salt); if (strlen($crypted) > 0) return(true); return(false); }
[vchkpw] Generate password in MySQL
Hi all, Can someone tell me how I can generate a password which could be used in the pw_passwd field in MySQL? If possible, I'd like MySQL to generate the password, can anyone give me some pointers? Cheers, Jonathan