\Zend_Crypt_Hmac
PHP implementation of the RFC 2104 Hash based Message Authentication Code algorithm.
- Copyright: Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- License: http://framework.zend.com/license/new-bsd New BSD License
Synopsis
class Zend_Crypt_Hmac
extends Zend_Crypt
{
- // constants
- const STRING = 'string';
- const BINARY = 'binary';
- // Inherited constants from Zend_Crypt
- const TYPE_OPENSSL = 'openssl';
- const TYPE_HASH = 'hash';
- const TYPE_MHASH = 'mhash';
- // members
- protected static $_key = NULL;
- protected static $_packFormat = NULL;
- protected static string $_hashAlgorithm = 'md5';
- protected static array $_supportedMhashAlgorithms = ;
- // Inherited members from Zend_Crypt
- protected static $_type;
- protected static array $_supportedAlgosOpenssl;
- protected static array $_supportedAlgosMhash;
- // methods
- public static string compute()
- protected static Zend_Crypt_Hmac _setHashAlgorithm()
- protected static string _hash()
- protected static integer _getMhashDefinition()
- // Inherited methods from Zend_Crypt
- public static unknown hash()
- protected static void _detectHashSupport()
- protected static string _digestHash()
- protected static string _digestMhash()
- protected static string _digestOpenssl()
Hierarchy
Extends
Tasks
Line | Task |
---|---|
39+ | Patch for refactoring failed tests (key block sizes >80 using internal algo) |
39+ | Check if mhash() is a required alternative (will be PECL-only soon) |
Constants
Name | Value |
---|---|
STRING | 'string' |
BINARY | 'binary' |
TYPE_OPENSSL | 'openssl' |
TYPE_HASH | 'hash' |
TYPE_MHASH | 'mhash' |
Members
protected
- $_hashAlgorithm
—
string
Hashing algorithm; can be the md5/sha1 functions or any algorithm name listed in the output of PHP 5.1.2+ hash_algos(). - $_key
—
string
The key to use for the hash - $_packFormat
—
string
pack() format to be used for current hashing method - $_supportedAlgosMhash — array
- $_supportedAlgosOpenssl — array
- $_supportedMhashAlgorithms
—
array
List of algorithms supported my mhash() - $_type
Methods
protected
- _getMhashDefinition() — 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.
- _hash() — Perform HMAC and return the keyed data
- _setHashAlgorithm() — Setter for the hash method.
public
- compute() — 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.