note 34148 added to function.mhash-keygen-s2k

From: Date: Thu, 17 Jul 2003 04:18:53 +0000
Subject: note 34148 added to function.mhash-keygen-s2k
Groups: php.notes 
Request: Send a blank email to php-notes+get-52248@lists.php.net to get a copy of this message
// given random 8 bits of salt and a clear text password $clear_pw = "p4ssw0rd" ; $rand8bites4salt = substr(pack("h*", md5(mt_rand())) , 0, 8); // This mhash_keygen_s2k(MHASH_MD5, $clear_pw, $rand8bites4salt, 4) ; //is the same as this function myhash_keyge_s2k($pass, $salt, $bytes ){ return substr(pack("H*", md5($salt . $pass)), 0, $bytes); } myhash_keyge_s2k($clear_pw, $rand8bites4salt, 4); // But the latter doesn't require mhash libs. // -ray ferguson ---- Manual Page -- http://www.php.net/manual/en/function.mhash-keygen-s2k.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34148 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34148&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34148&report=yes

« previous php.notes (#52248) next »