Index: modules/openid/openid.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.inc,v
retrieving revision 1.13
diff -u -r1.13 openid.inc
--- modules/openid/openid.inc	1 Nov 2008 19:51:06 -0000	1.13
+++ modules/openid/openid.inc	22 Apr 2009 16:55:59 -0000
@@ -26,11 +26,6 @@
 define('OPENID_DH_DEFAULT_GEN', '2');
 
 /**
- * SHA-1 hash block size; used for Diffie-Hellman key exchange computations.
- */
-define('OPENID_SHA1_BLOCKSIZE', 64);
-
-/**
  * Random number generator; used for Diffie-Hellman key exchange computations.
  */
 define('OPENID_RAND_SOURCE', '/dev/urandom');
@@ -267,29 +262,18 @@
 
 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 +327,7 @@
 
 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]));
