note 33043 added to function.crypt

From: Date: Sat, 14 Jun 2003 22:21:42 +0000
Subject: note 33043 added to function.crypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-50355@lists.php.net to get a copy of this message
With Openldap, how to check against a {SMD5}... password with php funtions ? Answer : $mypassword = "toto"; $smd5_pass = "{SMD5}......." // in openldap if (preg_match ("/{SMD5}/i", $smd5_pass)) { $encrypted = substr($md5_pass, 6); $hash = base64_decode($encrypted); $salt = substr($hash,16); $mhashed = mhash(MHASH_MD5, $mypassword . $salt) ; $without_salt = explode($salt,$hash_hex); if ($without_salt[0] == $mhashed) { echo "Password verified <br>"; } else { echo "Password Not verified<br>"; } } } ---- Manual Page -- http://www.php.net/manual/en/function.crypt.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33043 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33043&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33043&report=yes

« previous php.notes (#50355) next »