PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Encryption » Crypt_HMAC » Bug #3531

Key isnt padded when the original length > 64

Details

Submitted2005-02-20 12:56 UTC
FromJared dot Williams1 at ntlworld dot com
Assignedmfonda
StatusClosed
PackageCrypt_HMAC
PHP VersionIrrelevant
OSWindows 2000/IIS
Roadmaps(Not assigned)

Comments

[2005-02-20 12:56 UTC] Jared dot Williams1 at ntlworld dot com

Description:
------------
Probably a minor issue, but when a key is reduced in length via the hash function, it then requires padding.

$key = (strlen($key) > 64) ? pack($this->_pack, $func($key)) : str_pad($key, 64, chr(0));

Should be something like...

if (strlen($key) > 64)
$key = pack($this->_pack, $func($key));
if (strlen($key) < 64)
$key = str_pad($key, 64, chr(0));