note 93171 added to function.crypt

From: Date: Thu, 27 Aug 2009 02:21:04 +0000
Subject: note 93171 added to function.crypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-159912@lists.php.net to get a copy of this message
The makesalt() function code below when used to create an MD5 salt, produces a salt with characters not typically in a salt used by operating system crypt functions. Some of these characters may have unintended side effects depending on how they are used - including the following: @ ` ~ \ | {}. I am using the following to create MD5-Crypt hashes, (yes, I am assuming CRYPT_MD5 support is present). <?php function md5crypt($password){ // create a salt that ensures crypt creates an md5 hash $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ' .'abcdefghijklmnopqrstuvwxyz0123456789+/'; $salt='$1$'; for($i=0; $i<9; $i++){ $salt.=$base64_alphabet[rand(0,63)]; } // return the crypt md5 password return crypt($password,$salt.'$'); } ?> ---- Server IP: 203.89.181.186 Probable Submitter: 60.234.146.151 ---- Manual Page -- http://www.php.net/manual/en/function.crypt.php Edit -- https://master.php.net/note/edit/93171 Del: integrated -- https://master.php.net/note/delete/93171/integrated Del: useless -- https://master.php.net/note/delete/93171/useless Del: bad code -- https://master.php.net/note/delete/93171/bad+code Del: spam -- https://master.php.net/note/delete/93171/spam Del: non-english -- https://master.php.net/note/delete/93171/non-english Del: in docs -- https://master.php.net/note/delete/93171/in+docs Del: other reasons-- https://master.php.net/note/delete/93171 Reject -- https://master.php.net/note/reject/93171 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159912) next »