Crypt/Hmac.php
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.
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Crypt
- subpackage
- Hmac
- version
- $Id: Hmac.php 23775 2011-03-01 17:25:24Z ralph $
PHP implementation of the RFC 2104 Hash based Message Authentication Code
algorithm.
- Extends from
- \Zend_Crypt
- category
- Zend
- copyright
- Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- license
-
New BSD License
- package
- Zend_Crypt
- todo
- Patch for refactoring failed tests (key block sizes >80 using internal algo)
- todo
- Check if mhash() is a required alternative (will be PECL-only soon)
Constants


STRING
= 'string'
Constants representing the output mode of the hash algorithm
Properties



string
$_hashAlgorithm= 'md5'
staticHashing algorithm; can be the md5/sha1 functions or any algorithm name
listed in the output of PHP 5.1.2+ hash_algos().
Default valuemd5
Details
- Type
- string



string
$_key= 'null'
staticThe key to use for the hash
Default valuenull
Details
- Type
- string



string
$_packFormat= 'null'
staticpack() format to be used for current hashing method
Default valuenull
Details
- Type
- string



array
$_supportedMhashAlgorithms= 'array'
staticList of algorithms supported my mhash()
Default valuearray
Details
- Type
- array
Methods



_getMhashDefinition(
string $hashAlgorithm
)
:
integer
staticSince 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.
Parameters
Name |
Type |
Description |
$hashAlgorithm |
string |
|
Returns



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



_setHashAlgorithm(
string $hash
)
:
\Zend_Crypt_Hmac
staticSetter for the hash method.
Parameters
Name |
Type |
Description |
$hash |
string |
|
Returns



compute(
string $key, string $hash, string $data, string $output
=
self
)
:
string
staticPerforms 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.
Parameters
Name |
Type |
Description |
$key |
string |
|
$hash |
string |
|
$data |
string |
|
$output |
string |
|
Returns