API Documentation

Zend/Crypt/Hmac.php

Show: inherited
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 24594 2012-01-05 21:27:01Z 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

Constant  STRING = 'string'

Constants representing the output mode of the hash algorithm

Constant  BINARY = 'binary'

Properties

Propertyprotectedstring  $_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
Propertyprotectedstring  $_key= 'null'
static

The key to use for the hash

Default valuenullDetails
Type
string
Propertyprotectedstring  $_packFormat= 'null'
static

pack() format to be used for current hashing method

Default valuenullDetails
Type
string
Propertyprotectedarray  $_supportedMhashAlgorithms= 'array('adler32''
static

List of algorithms supported my mhash()

Default valuearray('adler32'Details
Type
array

Methods

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
Name Type Description
$hashAlgorithm string
Returns
Type Description
integer
methodprotected_hash( string $data, string $output = self::STRING, bool $internal = false ) : string
static

Perform 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
Type Description
string
methodprotected_setHashAlgorithm( string $hash ) : \Zend_Crypt_Hmac
static

Setter for the hash method.

Parameters
Name Type Description
$hash string
Returns
Type Description
\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
Name Type Description
$key string
$hash string
$data string
$output string
Returns
Type Description
string
Documentation was generated by DocBlox 0.15.1.