note 91302 added to function.mhash-keygen-s2k
| From: | newton at vsempizdec dot ru | Date: | Thu, 04 Jun 2009 15:43:33 +0000 |
| Subject: | note 91302 added to function.mhash-keygen-s2k | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156364@lists.php.net to get a copy of this message | ||
To both ray ferguson and gmic, the following code does exact the same as mhash function (you could
change MD5 to SHA1 and properly change block size, but those two are only options if you have no
mhash):
function my_keygen_s2k($_key, $salt, $length){
$blocksize = 16;
$times = (int) $length / $blocksize;
if($length % $blocksize != 0) $times ++;
$return = '';
for($i = 0; $i < $times; $i ++){
$return .= md5(str_repeat(chr(0), $i) . $salt . $_key, true);
}
return $return;
}
The output will be same as mhash_keygen_s2k function.
----
Server IP: 195.54.192.44
Probable Submitter: 78.106.73.115
----
Manual Page -- http://www.php.net/manual/en/function.mhash-keygen-s2k.php
Edit -- https://master.php.net/note/edit/91302
Del: integrated -- https://master.php.net/note/delete/91302/integrated
Del: useless -- https://master.php.net/note/delete/91302/useless
Del: bad code -- https://master.php.net/note/delete/91302/bad+code
Del: spam -- https://master.php.net/note/delete/91302/spam
Del: non-english -- https://master.php.net/note/delete/91302/non-english
Del: in docs -- https://master.php.net/note/delete/91302/in+docs
Del: other reasons-- https://master.php.net/note/delete/91302
Reject -- https://master.php.net/note/reject/91302
Search -- https://master.php.net/manage/user-notes.php