Class Zend_Crypt_Hmac

Description

PHP implementation of the RFC 2104 Hash based Message Authentication Code algorithm.

  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • 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)
  • license: New BSD License

Located in /Crypt/Hmac.php (line 39)

Zend_Crypt
   |
   --Zend_Crypt_Hmac
Class Constant Summary
 BINARY = 'binary'
 STRING = 'string'
Variable Summary
 static string $_hashAlgorithm
 static string $_key
 static string $_packFormat
Method Summary
 static string compute (string $key, string $hash, string $data, [string $output = self::STRING], boolean $internal)
 static integer _getMhashDefinition (string $hashAlgorithm)
 static string _hash (string $data, [string $output = self::STRING], [bool $internal = false])
 static Zend_Crypt_Hmac _setHashAlgorithm (string $hash)
Variables
static string $_hashAlgorithm = 'md5' (line 62)

Hashing algorithm; can be the md5/sha1 functions or any algorithm name listed in the output of PHP 5.1.2+ hash_algos().

  • access: protected
static string $_key = null (line 47)

The key to use for the hash

  • access: protected
static string $_packFormat = null (line 54)

pack() format to be used for current hashing method

  • access: protected
static array $_supportedMhashAlgorithms = array('adler32',' crc32', 'crc32b', 'gost',
'haval128', 'haval160', 'haval192', 'haval256', 'md4', 'md5', 'ripemd160',
'sha1', 'sha256', 'tiger', 'tiger128', 'tiger160')
(line 69)

List of algorithms supported my mhash()

  • access: protected

Inherited Variables

Inherited from Zend_Crypt

Zend_Crypt::$_supportedAlgosMhash
Zend_Crypt::$_supportedAlgosOpenssl
Zend_Crypt::$_type
Methods
static compute (line 91)

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.

  • access: public
static string compute (string $key, string $hash, string $data, [string $output = self::STRING], boolean $internal)
  • string $key
  • string $hash
  • string $data
  • string $output
  • boolean $internal
static _getMhashDefinition (line 172)

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.

  • access: protected
static integer _getMhashDefinition (string $hashAlgorithm)
  • string $hashAlgorithm
static _hash (line 146)

Perform HMAC and return the keyed data

  • access: protected
static string _hash (string $data, [string $output = self::STRING], [bool $internal = false])
  • string $data
  • string $output
  • bool $internal: Option to not use hash() functions for testing
static _setHashAlgorithm (line 113)

Setter for the hash method.

  • access: protected
static Zend_Crypt_Hmac _setHashAlgorithm (string $hash)
  • string $hash

Inherited Methods

Inherited From Zend_Crypt

 Zend_Crypt::hash()
 Zend_Crypt::_detectHashSupport()
 Zend_Crypt::_digestHash()
 Zend_Crypt::_digestMhash()
 Zend_Crypt::_digestOpenssl()
Class Constants
BINARY = 'binary' (line 77)
STRING = 'string' (line 76)

Constants representing the output mode of the hash algorithm

Inherited Constants

Inherited from Zend_Crypt

Zend_Crypt::TYPE_HASH
Zend_Crypt::TYPE_MHASH
Zend_Crypt::TYPE_OPENSSL

Documentation generated on Mon, 21 Jun 2010 15:26:48 -0400 by phpDocumentor 1.4.3