summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/openid/openid.inc19
1 files changed, 4 insertions, 15 deletions
diff --git a/modules/openid/openid.inc b/modules/openid/openid.inc
index 959a95a9f..c0ed8a936 100644
--- a/modules/openid/openid.inc
+++ b/modules/openid/openid.inc
@@ -267,29 +267,18 @@ function _openid_signature($association, $message_array, $keys_to_sign) {
function _openid_hmac($key, $text) {
if (strlen($key) > OPENID_SHA1_BLOCKSIZE) {
- $key = _openid_sha1($key, TRUE);
+ $key = sha1($key, TRUE);
}
$key = str_pad($key, OPENID_SHA1_BLOCKSIZE, chr(0x00));
$ipad = str_repeat(chr(0x36), OPENID_SHA1_BLOCKSIZE);
$opad = str_repeat(chr(0x5c), OPENID_SHA1_BLOCKSIZE);
- $hash1 = _openid_sha1(($key ^ $ipad) . $text, TRUE);
- $hmac = _openid_sha1(($key ^ $opad) . $hash1, TRUE);
+ $hash1 = sha1(($key ^ $ipad) . $text, TRUE);
+ $hmac = sha1(($key ^ $opad) . $hash1, TRUE);
return $hmac;
}
-function _openid_sha1($text) {
- $hex = sha1($text);
- $raw = '';
- for ($i = 0; $i < 40; $i += 2) {
- $hexcode = substr($hex, $i, 2);
- $charcode = (int)base_convert($hexcode, 16, 10);
- $raw .= chr($charcode);
- }
- return $raw;
-}
-
function _openid_dh_base64_to_long($str) {
$b64 = base64_decode($str);
@@ -343,7 +332,7 @@ function _openid_dh_long_to_binary($long) {
function _openid_dh_xorsecret($shared, $secret) {
$dh_shared_str = _openid_dh_long_to_binary($shared);
- $sha1_dh_shared = _openid_sha1($dh_shared_str);
+ $sha1_dh_shared = sha1($dh_shared_str, TRUE);
$xsecret = "";
for ($i = 0; $i < strlen($secret); $i++) {
$xsecret .= chr(ord($secret[$i]) ^ ord($sha1_dh_shared[$i]));