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


PHP Auth_OpenID_CryptUtil::randomString方法代碼示例

本文整理匯總了PHP中Auth_OpenID_CryptUtil::randomString方法的典型用法代碼示例。如果您正苦於以下問題:PHP Auth_OpenID_CryptUtil::randomString方法的具體用法?PHP Auth_OpenID_CryptUtil::randomString怎麽用?PHP Auth_OpenID_CryptUtil::randomString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Auth_OpenID_CryptUtil的用法示例。


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

示例1: OpenID_MemcStore

 function OpenID_MemcStore($prefix_part = null)
 {
     global $wgMemc, $wgDBname;
     if (isset($prefix_part)) {
         $this->prefix = $prefix_part . ':';
     }
     $auth_key = Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN);
     $k = $this->_authKeyKey();
     $res = $wgMemc->add($k, $auth_key);
 }
開發者ID:ErdemA,項目名稱:wikihow,代碼行數:10,代碼來源:MemcStore.php

示例2: Auth_OpenID_mkNonce

function Auth_OpenID_mkNonce($when = null)
{
    // Generate a nonce with the current timestamp
    $salt = Auth_OpenID_CryptUtil::randomString(6, Auth_OpenID_Nonce_CHRS);
    if ($when === null) {
        $when = gmmktime();
    }
    $time_str = gmstrftime(Auth_OpenID_Nonce_TIME_FMT, $when);
    return $time_str . $salt;
}
開發者ID:ramziammar,項目名稱:websites,代碼行數:10,代碼來源:Nonce.php

示例3: Auth_OpenID_mkNonce

function Auth_OpenID_mkNonce($when = null)
{
    // Generate a nonce with the current timestamp
    $salt = Auth_OpenID_CryptUtil::randomString(6, Auth_OpenID_Nonce_CHRS);
    if ($when === null) {
        // It's safe to call time() with no arguments; it returns a
        // GMT unix timestamp on PHP 4 and PHP 5.  gmmktime() with no
        // args returns a local unix timestamp on PHP 4, so don't use
        // that.
        $when = time();
    }
    $time_str = gmstrftime(Auth_OpenID_Nonce_TIME_FMT, $when);
    return $time_str . $salt;
}
開發者ID:kaantunc,項目名稱:MYK-BOR,代碼行數:14,代碼來源:Nonce.php

示例4: generate_nonce

	/**
	 * util function: current nonce
	 */
	private static function generate_nonce() {
		$mt = microtime();
		$rand = mt_rand();
		$md5 = md5($mt . $rand);

		$r = Auth_OpenID_CryptUtil::randomString(32,"abcdef01234567890");
		//print '<h1>microtime:: '.$mt.'  random:: '.$rand.'  md5:: '.$md5.'</h1>';

		return  $r;// md5s look nicer than numbers
	}
開發者ID:hoalangoc,項目名稱:ftf,代碼行數:13,代碼來源:OAuth.php

示例5: genAssoc

 /**
  * Generates an association with the specified parameters.
  */
 function genAssoc($now, $issued = 0, $lifetime = 600)
 {
     $sec = Auth_OpenID_CryptUtil::randomString(20);
     $hdl = Auth_OpenID_CryptUtil::randomString(128, $this->allowed_handle);
     return new Auth_OpenID_Association($hdl, $sec, $now + $issued, $lifetime, 'HMAC-SHA1');
 }
開發者ID:BGCX067,項目名稱:ezopenid-svn-to-git,代碼行數:9,代碼來源:StoreTest.php

示例6: setUp

 function setUp()
 {
     // Pre-compute DH with small prime so tests run quickly.
     $this->server_dh = new Auth_OpenID_DiffieHellman(100389557, 2);
     $this->consumer_dh = new Auth_OpenID_DiffieHellman(100389557, 2);
     $lib =& Auth_OpenID_getMathLib();
     $cls = $this->session_cls;
     $this->consumer_session = new $cls($this->consumer_dh);
     // base64(btwoc(g ^ xb mod p))
     $this->dh_server_public = $lib->longToBase64($this->server_dh->public);
     $this->secret = Auth_OpenID_CryptUtil::randomString($this->consumer_session->secret_size);
     $this->enc_mac_key = base64_encode($this->server_dh->xorSecret($this->consumer_dh->public, $this->secret, $this->consumer_session->hash_func));
     $this->msg = new Auth_OpenID_Message($this->message_namespace);
 }
開發者ID:umbecr,項目名稱:camilaframework,代碼行數:14,代碼來源:Consumer.php

示例7: _createNonce

 /**
  * @access private
  */
 function _createNonce()
 {
     $nonce = Auth_OpenID_CryptUtil::randomString($this->nonce_len, $this->nonce_chrs);
     $this->store->storeNonce($nonce);
     return $nonce;
 }
開發者ID:JJYing,項目名稱:Anyway-Website,代碼行數:9,代碼來源:Consumer.php

示例8: getAuthKey

 function getAuthKey()
 {
     $value = $this->_get_auth();
     if (!$value) {
         $auth_key = Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN);
         $auth_key_s = $this->blobEncode($auth_key);
         $this->_create_auth($auth_key_s);
     } else {
         $auth_key_s = $value;
         $auth_key = $this->blobDecode($auth_key_s);
     }
     $this->connection->commit();
     if (strlen($auth_key) != $this->AUTH_KEY_LEN) {
         $fmt = "Expected %d-byte string for auth key. Got key of length %d";
         trigger_error(sprintf($fmt, $this->AUTH_KEY_LEN, strlen($auth_key)), E_USER_WARNING);
         return null;
     }
     return $auth_key;
 }
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:19,代碼來源:SQLStore.php

示例9: createAuthKey

 /**
  * Generate a new random auth key and safely store it in the
  * location specified by $this->auth_key_name.
  *
  * @return string $key
  */
 function createAuthKey()
 {
     if (!$this->active) {
         trigger_error("FileStore no longer active", E_USER_ERROR);
         return null;
     }
     $auth_key = Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN);
     list($file_obj, $tmp) = $this->_mktemp();
     fwrite($file_obj, $auth_key);
     fflush($file_obj);
     fclose($file_obj);
     if (function_exists('link')) {
         // Posix filesystem
         $saved = link($tmp, $this->auth_key_name);
         Auth_OpenID_FileStore::_removeIfPresent($tmp);
     } else {
         // Windows filesystem
         $saved = rename($tmp, $this->auth_key_name);
     }
     if (!$saved) {
         // The link failed, either because we lack the permission,
         // or because the file already exists; try to read the key
         // in case the file already existed.
         $auth_key = $this->readAuthKey();
     }
     return $auth_key;
 }
開發者ID:Cyberspace-Networks,項目名稱:PeopleAggregator,代碼行數:33,代碼來源:FileStore.php


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