note 37841 added to function.mhash-keygen-s2k

From: Date: Sat, 29 Nov 2003 03:51:52 +0000
Subject: note 37841 added to function.mhash-keygen-s2k
Groups: php.notes 
Request: Send a blank email to php-notes+get-61105@lists.php.net to get a copy of this message
//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. ---- Manual Page -- http://www.php.net/manual/en/function.mhash-keygen-s2k.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37841 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37841&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37841&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61105) next »