Crypt/Hmac.php

Show: PublicProtectedPrivateinherited
Table of Contents
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Crypt  
Subpackage
Hmac  
Version
$Id: Hmac.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Crypt_Hmac

Package: Zend\Crypt
PHP implementation of the RFC 2104 Hash based Message Authentication Code algorithm.
Parent(s)
\Zend_Crypt
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
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

>VConstant  STRING = 'string'
Constants representing the output mode of the hash algorithm
>VConstant  BINARY = 'binary'
>VConstant  TYPE_OPENSSL = 'openssl'
inheritedInherited from: \Zend_Crypt::TYPE_OPENSSL
Inherited_from
\Zend_Crypt::TYPE_OPENSSL  
>VConstant  TYPE_HASH = 'hash'
inheritedInherited from: \Zend_Crypt::TYPE_HASH
Inherited_from
\Zend_Crypt::TYPE_HASH  
>VConstant  TYPE_MHASH = 'mhash'
inheritedInherited from: \Zend_Crypt::TYPE_MHASH
Inherited_from
\Zend_Crypt::TYPE_MHASH  

Properties

>VPropertyprotectedstring $_hashAlgorithm = 'md5'
static
Hashing algorithm; can be the md5/sha1 functions or any algorithm name listed in the output of PHP 5.1.2+ hash_algos().
Default value'md5'Details
Type
string
>VPropertyprotectedstring $_key = null
static
The key to use for the hash
Default valuenullDetails
Type
string
>VPropertyprotectedstring $_packFormat = null
static
pack() format to be used for current hashing method
Default valuenullDetails
Type
string
>VPropertyprotectedarray $_supportedAlgosMhash = array('adler32', 'crc32', 'crc32b', 'gost', 'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160', 'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160')
staticinherited
Inherited from: \Zend_Crypt::$$_supportedAlgosMhash
Default valuearray('adler32', 'crc32', 'crc32b', 'gost', 'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160', 'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160')Details
Type
array
Inherited_from
\Zend_Crypt::$$_supportedAlgosMhash  
>VPropertyprotectedarray $_supportedAlgosOpenssl = array('md2', 'md4', 'mdc2', 'rmd160', 'sha', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')
staticinherited
Inherited from: \Zend_Crypt::$$_supportedAlgosOpenssl
Default valuearray('md2', 'md4', 'mdc2', 'rmd160', 'sha', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')Details
Type
array
Inherited_from
\Zend_Crypt::$$_supportedAlgosOpenssl  
>VPropertyprotectedarray $_supportedMhashAlgorithms = array('adler32', ' crc32', 'crc32b', 'gost', 'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160', 'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160')
static
List of algorithms supported my mhash()
Default valuearray('adler32', ' crc32', 'crc32b', 'gost', 'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160', 'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160')Details
Type
array
>VPropertyprotected$_type = null
staticinheritedInherited from: \Zend_Crypt::$$_type
Default valuenullDetails
Type
n/a
Inherited_from
\Zend_Crypt::$$_type  

Methods

methodprotected_detectHashSupport(string $algorithm) : void
staticinherited

Inherited from: \Zend_Crypt::_detectHashSupport()
Parameters
NameTypeDescription
$algorithmstring
Throws
ExceptionDescription
\Zend_Crypt_Exception
methodprotected_digestHash(string $algorithm, string $data, bool $binaryOutput) : string
staticinherited

Inherited from: \Zend_Crypt::_digestHash()
Parameters
NameTypeDescription
$algorithmstring
$datastring
$binaryOutputbool
Returns
TypeDescription
string
methodprotected_digestMhash(string $algorithm, string $data, bool $binaryOutput) : string
staticinherited

Inherited from: \Zend_Crypt::_digestMhash()
Parameters
NameTypeDescription
$algorithmstring
$datastring
$binaryOutputbool
Returns
TypeDescription
string
methodprotected_digestOpenssl(string $algorithm, string $data, bool $binaryOutput) : string
staticinherited

Inherited from: \Zend_Crypt::_digestOpenssl()
Parameters
NameTypeDescription
$algorithmstring
$datastring
$binaryOutputbool
Returns
TypeDescription
string
methodprotected_getMhashDefinition(string $hashAlgorithm) : integer
static

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.

Parameters
NameTypeDescription
$hashAlgorithmstring
Returns
TypeDescription
integer
methodprotected_hash(string $data, string $output = self::STRING, bool $internal = false) : string
static

Perform HMAC and return the keyed data

Parameters
NameTypeDescription
$datastring
$outputstring
$internalbool

Option to not use hash() functions for testing

Returns
TypeDescription
string
methodprotected_setHashAlgorithm(string $hash) : \Zend_Crypt_Hmac
static

Setter for the hash method.

Parameters
NameTypeDescription
$hashstring
Returns
TypeDescription
\Zend_Crypt_Hmac
methodpubliccompute(string $key, string $hash, string $data, string $output = self::STRING) : string
static

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.

Parameters
NameTypeDescription
$keystring
$hashstring
$datastring
$outputstring
Returns
TypeDescription
string
methodpublichash(string $algorithm, string $data, bool $binaryOutput = false) : \unknown
staticinherited

Inherited from: \Zend_Crypt::hash()
Parameters
NameTypeDescription
$algorithmstring
$datastring
$binaryOutputbool
Returns
TypeDescription
\unknown
Documentation was generated by phpDocumentor 2.0.0a12.