gehe zum Quellcode dieser Datei
Namensbereiche | |
namespace | OpenID |
Aufzählungen | |
enum | Auth_OpenID_SHA1_BLOCKSIZE |
Funktionen | |
Auth_OpenID_SHA1 ($text) | |
Auth_OpenID_HMACSHA1 ($key, $text) |
Auth_OpenID_HMACSHA1 | ( | $ | key, | |
$ | text | |||
) |
Compute an HMAC/SHA1 hash.
private
string | $key The HMAC key | |
string | $text The message text to hash |
Definiert in Zeile 57 der Datei HMAC.php.
00058 { 00059 if (Auth_OpenID::bytes($key) > Auth_OpenID_SHA1_BLOCKSIZE) { 00060 $key = Auth_OpenID_SHA1($key, true); 00061 } 00062 00063 $key = str_pad($key, Auth_OpenID_SHA1_BLOCKSIZE, chr(0x00)); 00064 $ipad = str_repeat(chr(0x36), Auth_OpenID_SHA1_BLOCKSIZE); 00065 $opad = str_repeat(chr(0x5c), Auth_OpenID_SHA1_BLOCKSIZE); 00066 $hash1 = Auth_OpenID_SHA1(($key ^ $ipad) . $text, true); 00067 $hmac = Auth_OpenID_SHA1(($key ^ $opad) . $hash1, true); 00068 return $hmac; 00069 } 00070 00071 if (function_exists('hash') && 00072 function_exists('hash_algos') && 00073 (in_array('sha256', hash_algos()))) { 00074 function Auth_OpenID_SHA256($text) 00075 { 00076 // PHP 5 case: 'hash' available and 'sha256' algo supported. 00077 return hash('sha256', $text, true); 00078 } 00079 define('Auth_OpenID_SHA256_SUPPORTED', true); 00080 } else {
Auth_OpenID_SHA1 | ( | $ | text | ) |
Definiert in Zeile 25 der Datei HMAC.php.
00026 { 00027 if (function_exists('hash') && 00028 function_exists('hash_algos') && 00029 (in_array('sha1', hash_algos()))) { 00030 // PHP 5 case (sometimes): 'hash' available and 'sha1' algo 00031 // supported. 00032 return hash('sha1', $text, true); 00033 } else if (function_exists('sha1')) { 00034 // PHP 4 case: 'sha1' available. 00035 $hex = sha1($text); 00036 $raw = ''; 00037 for ($i = 0; $i < 40; $i += 2) { 00038 $hexcode = substr($hex, $i, 2); 00039 $charcode = (int)base_convert($hexcode, 16, 10); 00040 $raw .= chr($charcode); 00041 } 00042 return $raw; 00043 } else { 00044 // Explode. 00045 trigger_error('No SHA1 function found', E_USER_ERROR); 00046 } 00047 }
Copyright © 2003 - 2009 MyOOS [Shopsystem]. All rights reserved. MyOOS [Shopsystem] is Free Software released under the GNU/GPL License. Webmaster: info@r23.de (Impressum) |
|