PHP implementation of the RFC 2104 Hash based Message Authentication Code
algorithm.
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) |
category |
Zend |
package |
Zend_Crypt |
copyright |
Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license |
New BSD License |
inherited_from |
\Zend_Crypt |
Methods
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.
compute(string $key, string $hash, string $data, string $output = self::STRING
) : string
Static
Parameters
$key
string
$hash
string
$data
string
$output
string
Exceptions
\Zend_Crypt_Hmac_Exception |
|
Returns
string
hash()
hash(string $algorithm, string $data, boolean $binaryOutput = false
) : \unknown
InheritedStatic
Parameters
$algorithm
string
$data
string
$binaryOutput
boolean
Returns
\unknown
_detectHashSupport()
_detectHashSupport(string $algorithm)
InheritedStatic
Parameters
$algorithm
string
Exceptions
_digestHash()
_digestHash(string $algorithm, string $data, boolean $binaryOutput) : string
InheritedStatic
Parameters
$algorithm
string
$data
string
$binaryOutput
boolean
Returns
string
_digestMhash()
_digestMhash(string $algorithm, string $data, boolean $binaryOutput) : string
InheritedStatic
Parameters
$algorithm
string
$data
string
$binaryOutput
boolean
Returns
string
_digestOpenssl()
_digestOpenssl(string $algorithm, string $data, boolean $binaryOutput) : string
InheritedStatic
Parameters
$algorithm
string
$data
string
$binaryOutput
boolean
Returns
string
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.
_getMhashDefinition(string $hashAlgorithm) : integer
Static
Parameters
$hashAlgorithm
string
Returns
integer
Perform HMAC and return the keyed data
_hash(string $data, string $output = self::STRING
, boolean $internal = false
) : string
Static
Parameters
$data
string
$output
string
$internal
boolean
Option to not use hash() functions for testing
Returns
string
Setter for the hash method.
_setHashAlgorithm(string $hash) : \Zend_Crypt_Hmac
Static
Parameters
$hash
string
Exceptions
\Zend_Crypt_Hmac_Exception |
|
Returns
\Zend_Crypt_Hmac
Properties
Hashing algorithm; can be the md5/sha1 functions or any algorithm name
listed in the output of PHP 5.1.2+ hash_algos().
$_hashAlgorithm : string
Static
The key to use for the hash
$_key : string
Static
$_supportedAlgosMhash
$_supportedAlgosMhash : array
Default
array('adler32', 'crc32', 'crc32b', 'gost', 'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160', 'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160')
Static
$_supportedAlgosOpenssl
$_supportedAlgosOpenssl : array
Default
array('md2', 'md4', 'mdc2', 'rmd160', 'sha', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')
Static
List of algorithms supported my mhash()
$_supportedMhashAlgorithms : array
Default
array('adler32', ' crc32', 'crc32b', 'gost', 'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160', 'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160')
Static
Constants
Constants representing the output mode of the hash algorithm
STRING = 'string'
TYPE_HASH
TYPE_HASH = 'hash'
TYPE_MHASH
TYPE_MHASH = 'mhash'
TYPE_OPENSSL
TYPE_OPENSSL = 'openssl'