Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
PHP implementation of the RFC 2104 Hash based Message Authentication Code algorithm.

string
$_hashAlgorithm= ''md5''
Hashing algorithm; can be the md5/sha1 functions or any algorithm name listed in the output of PHP 5.1.2+ hash_algos().
'md5'
Details
string
$_packFormat= 'null'
pack() format to be used for current hashing method
null
Details
_getMhashDefinition(
string $hashAlgorithm
)
:
integer
Since MHASH accepts an integer constant representing the hash algorithm we need to make a small detour to get the correct integer matching our algorithm's name.
Name | Type | Description |
---|---|---|
$hashAlgorithm | string |
Type | Description |
---|---|
integer |

_hash(
string $data, string $output
=
self::STRING, bool $internal
=
false
)
:
string
Perform HMAC and return the keyed data
Name | Type | Description |
---|---|---|
$data | string | |
$output | string | |
$internal | bool | Option to not use hash() functions for testing |
Type | Description |
---|---|
string |

compute(
string $key, string $hash, string $data, string $output
=
self::STRING
)
:
string
Performs a HMAC computation given relevant details such as Key, Hashing algorithm, the data to compute MAC of, and an output format of String, Binary notation or BTWOC.
Name | Type | Description |
---|---|---|
$key | string | |
$hash | string | |
$data | string | |
$output | string |
Type | Description |
---|---|
string |