note 37841 deleted from function.mhash-keygen-s2k by didou

From: Date: Sun, 21 Jan 2007 14:41:33 +0000
Subject: note 37841 deleted from function.mhash-keygen-s2k by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-121985@lists.php.net to get a copy of this message
Note Submitter: Ray Ferguson ---- //A more usefull example for generating SMD5 passwords. function ldap_smd5_passwd($clear_pw) { $salt = myhash_keyge_s2k($clear_pw, 4); $new_password = base64_encode(pack("H*", md5($clear_pw . $salt)) . $salt); return $new_password ; } function myhash_keyge_s2k($pass, $bytes ){ // This and md5 implimentation of the Salted S2K algorithm as // specified in the OpenPGP document (RFC 2440). // basically a non mhash dependant version of mhash_keygen_s2k $salt=substr(pack("h*", md5(mt_rand())), 0, 8); return substr(pack("H*", md5($salt . $pass)), 0, $bytes); } // -ray again.

« previous php.notes (#121985) next »