當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Auth_OpenID_SHA1函數代碼示例

本文整理匯總了PHP中Auth_OpenID_SHA1函數的典型用法代碼示例。如果您正苦於以下問題:PHP Auth_OpenID_SHA1函數的具體用法?PHP Auth_OpenID_SHA1怎麽用?PHP Auth_OpenID_SHA1使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Auth_OpenID_SHA1函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Auth_OpenID_HMACSHA1

/**
 * Compute an HMAC/SHA1 hash.
 *
 * @access private
 * @param string $key The HMAC key
 * @param string $text The message text to hash
 * @return string $mac The MAC
 */
function Auth_OpenID_HMACSHA1($key, $text)
{
    if (Auth_OpenID::bytes($key) > Auth_OpenID_SHA1_BLOCKSIZE) {
        $key = Auth_OpenID_SHA1($key, true);
    }
    $key = str_pad($key, Auth_OpenID_SHA1_BLOCKSIZE, chr(0x0));
    $ipad = str_repeat(chr(0x36), Auth_OpenID_SHA1_BLOCKSIZE);
    $opad = str_repeat(chr(0x5c), Auth_OpenID_SHA1_BLOCKSIZE);
    $hash1 = Auth_OpenID_SHA1(($key ^ $ipad) . $text, true);
    $hmac = Auth_OpenID_SHA1(($key ^ $opad) . $hash1, true);
    return $hmac;
}
開發者ID:sdgdsffdsfff,項目名稱:auth-center,代碼行數:20,代碼來源:HMAC.php

示例2: Auth_OpenID_HMACSHA1

/**
 * Compute an HMAC/SHA1 hash.
 *
 * @access private
 * @param string $key The HMAC key
 * @param string $text The message text to hash
 * @return string $mac The MAC
 */
function Auth_OpenID_HMACSHA1($key, $text)
{
    if (Auth_OpenID::bytes($key) > Auth_OpenID_SHA1_BLOCKSIZE) {
        $key = Auth_OpenID_SHA1($key, true);
    }
    if (function_exists('hash_hmac') && function_exists('hash_algos') && in_array('sha1', hash_algos())) {
        return hash_hmac('sha1', $text, $key, true);
    }
    // Home-made solution
    $key = str_pad($key, Auth_OpenID_SHA1_BLOCKSIZE, chr(0x0));
    $ipad = str_repeat(chr(0x36), Auth_OpenID_SHA1_BLOCKSIZE);
    $opad = str_repeat(chr(0x5c), Auth_OpenID_SHA1_BLOCKSIZE);
    $hash1 = Auth_OpenID_SHA1(($key ^ $ipad) . $text, true);
    $hmac = Auth_OpenID_SHA1(($key ^ $opad) . $hash1, true);
    return $hmac;
}
開發者ID:marcioyonamine,項目名稱:php-openid,代碼行數:24,代碼來源:HMAC.php

示例3: Auth_OpenID_DumbStore

 /**
  * Creates a new {@link Auth_OpenID_DumbStore} instance. For the security
  * of the tokens generated by the library, this class attempts to
  * at least have a secure implementation of getAuthKey.
  *
  * When you create an instance of this class, pass in a secret
  * phrase. The phrase is hashed with sha1 to make it the correct
  * length and form for an auth key. That allows you to use a long
  * string as the secret phrase, which means you can make it very
  * difficult to guess.
  *
  * Each {@link Auth_OpenID_DumbStore} instance that is created for use by
  * your consumer site needs to use the same $secret_phrase.
  *
  * @param string secret_phrase The phrase used to create the auth
  * key returned by getAuthKey
  */
 function Auth_OpenID_DumbStore($secret_phrase)
 {
     $this->auth_key = Auth_OpenID_SHA1($secret_phrase);
 }
開發者ID:dalandis,項目名稱:Visualization-of-Cell-Phone-Locations,代碼行數:21,代碼來源:DumbStore.php

示例4: xorSecret

 function xorSecret($composite, $secret)
 {
     $dh_shared = $this->getSharedSecret($composite);
     $dh_shared_str = $this->lib->longToBinary($dh_shared);
     $sha1_dh_shared = Auth_OpenID_SHA1($dh_shared_str);
     $xsecret = "";
     for ($i = 0; $i < strlen($secret); $i++) {
         $xsecret .= chr(ord($secret[$i]) ^ ord($sha1_dh_shared[$i]));
     }
     return $xsecret;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:11,代碼來源:DiffieHellman.php

示例5: _safe64

 /**
  * @access private
  */
 function _safe64($str)
 {
     $h64 = base64_encode(Auth_OpenID_SHA1($str));
     $h64 = str_replace('+', '_', $h64);
     $h64 = str_replace('/', '.', $h64);
     $h64 = str_replace('=', '', $h64);
     return $h64;
 }
開發者ID:danielkjfrog,項目名稱:docker,代碼行數:11,代碼來源:FileStore.php

示例6: __construct

 /**
  * Creates a new {@link Auth_OpenID_DumbStore} instance. For the security
  * of the tokens generated by the library, this class attempts to
  * at least have a secure implementation of getAuthKey.
  *
  * When you create an instance of this class, pass in a secret
  * phrase. The phrase is hashed with sha1 to make it the correct
  * length and form for an auth key. That allows you to use a long
  * string as the secret phrase, which means you can make it very
  * difficult to guess.
  *
  * Each {@link Auth_OpenID_DumbStore} instance that is created for use by
  * your consumer site needs to use the same $secret_phrase.
  *
  * @param string secret_phrase The phrase used to create the auth
  * key returned by getAuthKey
  */
 function __construct($secret_phrase)
 {
     $this->auth_key = Auth_OpenID_SHA1($secret_phrase);
 }
開發者ID:openid,項目名稱:php-openid,代碼行數:21,代碼來源:DumbStore.php

示例7: hashPassword

/**
 * Return a hashed form of the user's password
 */
function hashPassword($password)
{
    return bin2hex(Auth_OpenID_SHA1($password));
}
開發者ID:utopszkij,項目名稱:keszlet,代碼行數:7,代碼來源:session.php


注:本文中的Auth_OpenID_SHA1函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。