Home » Encryption » Crypt_HMAC » Bug #8399
for compatibility with "http://pajhome.org.uk/crypt/md5" and "RFC 2104" ....
Details
| Request #8399 | for compatibility with "http://pajhome.org.uk/crypt/md5" and "RFC 2104" .... |
|---|---|
| Submitted | 2006-08-09 13:28 UTC |
| From | sadeghi85 at gmail dot com |
| Status | Closed |
| Package | Crypt_HMAC |
| PHP Version | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2006-08-09 13:28 UTC] sadeghi85 at gmail dot com
Description:
------------
For compatibility with "http://pajhome.org.uk/crypt/md5" and "RFC 2104", "Crypt/HMAC" needs one additional line in function setKey.
Added line : "$key = str_pad($key, 64, chr(0));" on line 121.
Test script:
---------------
function setKey($key)
{
/*
* Pad the key as the RFC wishes
*/
$func = $this->_func;
if (strlen($key) > 64) {
$key = pack($this->_pack, $func($key));
$key = str_pad($key, 64, chr(0));// *Added line
}
if (strlen($key) < 64) {
$key = str_pad($key, 64, chr(0));
}
/* Calculate the padded keys and save them */
$this->_ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
$this->_opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));
}
Expected result:
----------------
results from HMAC-md5 of md5.js(http://pajhome.org.uk/crypt/md5) and Pear/Crypt/HMAC is not equal.
equality expected.
[2006-08-09 14:11 UTC] sadeghi85 at gmail dot com
I mistake!