Go to the source code of this file.
|
| OpenID |
| This module contains code for dealing with associations between consumers and servers.
|
|
|
const | Auth_OpenID_SHA1_BLOCKSIZE 64 |
| SHA1_BLOCKSIZE is this module's SHA1 blocksize used by the fallback implementation. More...
|
|
if(function_exists('hash') &&function_exists('hash_algos') &&(in_array('sha256', hash_algos()))) | else |
|
◆ Auth_OpenID_HMACSHA1()
Auth_OpenID_HMACSHA1 |
( |
|
$key, |
|
|
|
$text |
|
) |
| |
Compute an HMAC/SHA1 hash.
private
- Parameters
-
string | $key | The HMAC key |
string | $text | The message text to hash |
- Returns
- string $mac The MAC
Definition at line 57 of file HMAC.php.
References Auth_OpenID_SHA1(), Auth_OpenID_SHA1_BLOCKSIZE, and Auth_OpenID\bytes().
71 if (function_exists(
'hash') &&
72 function_exists(
'hash_algos') &&
73 (in_array(
'sha256', hash_algos()))) {
74 function Auth_OpenID_SHA256($text)
77 return hash(
'sha256', $text,
true);
79 define(
'Auth_OpenID_SHA256_SUPPORTED',
true);
81 define(
'Auth_OpenID_SHA256_SUPPORTED',
false);
84 if (function_exists(
'hash_hmac') &&
85 function_exists(
'hash_algos') &&
86 (in_array(
'sha256', hash_algos()))) {
88 function Auth_OpenID_HMACSHA256($key, $text)
91 return hash_hmac(
'sha256', $text, $key,
true);
94 define(
'Auth_OpenID_HMACSHA256_SUPPORTED',
true);
static bytes($str)
Count the number of bytes in a string independently of multibyte support conditions.
const Auth_OpenID_SHA1_BLOCKSIZE
SHA1_BLOCKSIZE is this module's SHA1 blocksize used by the fallback implementation.
◆ Auth_OpenID_SHA1()
Auth_OpenID_SHA1 |
( |
|
$text | ) |
|
Definition at line 25 of file HMAC.php.
Referenced by Auth_OpenID_FileStore\_safe64(), Auth_OpenID_DumbStore\Auth_OpenID_DumbStore(), and Auth_OpenID_HMACSHA1().
27 if (function_exists(
'hash') &&
28 function_exists(
'hash_algos') &&
29 (in_array(
'sha1', hash_algos()))) {
32 return hash(
'sha1', $text,
true);
33 }
else if (function_exists(
'sha1')) {
37 for ($i = 0; $i < 40; $i += 2) {
38 $hexcode = substr($hex, $i, 2);
39 $charcode = (int)base_convert($hexcode, 16, 10);
40 $raw .= chr($charcode);
45 trigger_error(
'No SHA1 function found', E_USER_ERROR);
◆ Auth_OpenID_SHA1_BLOCKSIZE
const Auth_OpenID_SHA1_BLOCKSIZE 64 |
SHA1_BLOCKSIZE is this module's SHA1 blocksize used by the fallback implementation.
Definition at line 23 of file HMAC.php.
Referenced by Auth_OpenID_HMACSHA1().
◆ else
if (function_exists( 'hash_hmac') &&function_exists( 'hash_algos') &&(in_array( 'sha256', hash_algos()))) else |
Initial value:{
define('Auth_OpenID_SHA256_SUPPORTED', false)
Definition at line 80 of file HMAC.php.