17 require_once
'Auth/OpenID.php';
23 define(
'Auth_OpenID_SHA1_BLOCKSIZE', 64);
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);
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);
96 define(
'Auth_OpenID_HMACSHA256_SUPPORTED',
false);
static bytes($str)
Count the number of bytes in a string independently of multibyte support conditions.
Auth_OpenID_HMACSHA1($key, $text)
Compute an HMAC/SHA1 hash.
const Auth_OpenID_SHA1_BLOCKSIZE
SHA1_BLOCKSIZE is this module's SHA1 blocksize used by the fallback implementation.