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);
63 if (function_exists(
'hash_hmac') &&
64 function_exists(
'hash_algos') &&
65 (in_array(
'sha1', hash_algos()))) {
66 return hash_hmac(
'sha1', $text, $key,
true);
78 if (function_exists(
'hash') &&
79 function_exists(
'hash_algos') &&
80 (in_array(
'sha256', hash_algos()))) {
81 function Auth_OpenID_SHA256($text)
84 return hash(
'sha256', $text,
true);
86 define(
'Auth_OpenID_SHA256_SUPPORTED',
true);
88 define(
'Auth_OpenID_SHA256_SUPPORTED',
false);
91 if (function_exists(
'hash_hmac') &&
92 function_exists(
'hash_algos') &&
93 (in_array(
'sha256', hash_algos()))) {
95 function Auth_OpenID_HMACSHA256($key, $text)
98 return hash_hmac(
'sha256', $text, $key,
true);
101 define(
'Auth_OpenID_HMACSHA256_SUPPORTED',
true);
103 define(
'Auth_OpenID_HMACSHA256_SUPPORTED',
false);
if(!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE' E_USER_ERROR
const Auth_OpenID_SHA1_BLOCKSIZE
Auth_OpenID_HMACSHA1($key, $text)