当前位置: 首页>>代码示例>>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;未经允许,请勿转载。