_hash_hmac [ WordPress Function ]
_hash_hmac ( $algo, $data, $key, $raw_output = false )
| Defined at: |
|
No description yet.
Source
<?php
function _hash_hmac($algo, $data, $key, $raw_output = false) {
$packs = array('md5' => 'H32', 'sha1' => 'H40');
if ( !isset($packs[$algo]) )
return false;
$pack = $packs[$algo];
if (strlen($key) > 64)
$key = pack($pack, $algo($key));
$key = str_pad($key, 64, chr(0));
$ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));
$opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));
$hmac = $algo($opad . pack($pack, $algo($ipad . $data)));
if ( $raw_output )
return pack( $pack, $hmac );
return $hmac;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- PHP: hash_hmac - Manual
Parameters. algo. Name of selected hashing algorithm (i.e. "md5", "sha256", " haval160,4", etc..) See hash_algos() for a list of supported algorithms. data ...
php.net - fCryptography - API Reference - Flourish
checkPasswordHash(); hashHMAC(); hashPassword(); publicKeyDecrypt(); publicKeyEncrypt() ... string hashHMAC( string $algorithm, string $data, string $ key ) ...
flourishlib.com - hash - HMAC-SHA1: How to do it properly in Java? - Stack Overflow
On your PHP side, use single-quotes around the key so that the $ character is not treated as a variable reference. i.e., hash_hmac("sha1" ...
stackoverflow.com - SHA-1, SHA-2 hash, HMAC and AES function - LAVA
I would like to offer my SHA-1, SHA-2 HMAC and AES files to OpenG to add to the MD5 library (I suppose we need to rename that palette).
lavag.org