本文整理汇总了PHP中Crypt_Blowfish类的典型用法代码示例。如果您正苦于以下问题:PHP Crypt_Blowfish类的具体用法?PHP Crypt_Blowfish怎么用?PHP Crypt_Blowfish使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Crypt_Blowfish类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: isDefault
/**
* isDefault
*
* @access public
* @return bool false if the user is authenticated, true if not (default user)
*/
public function isDefault()
{
$session =& Framework_Session::singleton();
if (is_null($session->email)) {
return true;
}
// Check timeout
$time = time();
$lastActionTime = $session->lastActionTime;
$timeLimit = (int) Framework::$site->config->inactiveTimeout;
$this->recordio("timeout info: time: {$time}, lastActionTime: {$lastActionTime}, timeLimit: {$timeLimit}");
if ($time - $lastActionTime > $timeLimit) {
header('Location: ./?module=Login&event=logoutInactive');
return false;
}
// Authenticate
$encryptedPass = $session->password;
$crypt = new Crypt_Blowfish((string) Framework::$site->config->mcryptKey);
$plainPass = $crypt->decrypt($encryptedPass);
if ($this->authenticate($session->email, $plainPass)) {
$session->lastActionTime = $time;
return false;
}
return true;
}
开发者ID:shupp,项目名称:toasteradmin,代码行数:31,代码来源:ToasterAdmin.php
示例2: CheckLicense
function CheckLicense()
{
global $LKey, $Trial, $SaveVars, $Errors, $Lang, $CLang;
if (!$LKey && !$Trial) {
return false;
}
if ($LKey) {
$BF = new Crypt_Blowfish('ns tracker license ');
$Decoded = $BF->decrypt($LKey);
$LArray = GetLicenseText($Decoded);
if ($LArray) {
if (!isset($LArray['P'])) {
$Errors[] = $Lang['SecondaryKey'];
return;
}
$GLOBALS['LArray'] = $LArray;
foreach ($LArray as $Key => $Val) {
$GLOBALS['Lc' . $Key] = $Val;
$SaveVars[] = "Lc" . $Key;
}
} else {
$Errors[] = $Lang['BadLicense'];
}
}
if (count($Errors)) {
return;
}
NextStep();
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:29,代码来源:func.php
示例3: fetchData
function fetchData($username, $password)
{
switch ($this->options['cryptType']) {
case 'blowfish':
include_once 'Crypt/Blowfish.php';
$bf = new Crypt_Blowfish($this->options['cryptKey']);
$password = $bf->encrypt($password);
$password = base64_encode($password);
break;
default:
if (function_exists($this->options['cryptType'])) {
$password = $this->options['cryptType']($password);
}
break;
}
$req = new HTTP_Request();
$req->setURL($this->options['URL']);
$req->setMethod(HTTP_REQUEST_METHOD_GET);
$req->addQueryString($this->options['usernameKey'], $username);
$req->addQueryString($this->options['passwordKey'], $password);
if (!PEAR::isError($req->sendRequest())) {
$response = $req->getResponseBody();
} else {
return false;
}
$unserializer = new XML_Unserializer();
if ($unserializer->unserialize($response)) {
$this->result_value = $unserializer->getUnserializedData();
if ($this->result_value[$this->options['resultKey']] == $this->options['correctValue']) {
return true;
}
}
return false;
}
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:34,代码来源:REST_XML.php
示例4: loginNow
/**
* loginNow
*
* Try and log the user in.
*
* @access public
* @return void
*/
public function loginNow()
{
$this->tplFile = 'Login.tpl';
$form = $this->createLoginForm();
if ($form->validate()) {
$result = $this->user->authenticate($_POST['email'], $_POST['password']);
if (!$result) {
$this->setData('loginError', _('Login failed'));
$this->setData('QF_Form', $form->toHtml());
$this->session->email = null;
$this->session->password = null;
return;
}
$crypt = new Crypt_Blowfish((string) Framework::$site->config->mcryptKey);
$emailArray = explode('@', $_POST['email']);
$this->session->user = $emailArray[0];
$this->session->domain = $emailArray[1];
$this->session->email = $_POST['email'];
$this->session->password = $crypt->encrypt($_POST['password']);
$this->session->lastActionTime = time();
header('Location: ./index.php?module=Home');
return;
} else {
$this->setData('QF_Form', $form->toHtml());
}
}
开发者ID:shupp,项目名称:toasteradmin,代码行数:34,代码来源:Login.php
示例5: __construct
public function __construct($secret)
{
$bf = new Crypt_Blowfish('cbc');
$bf->setKey($secret);
if (PEAR::isError($bf)) {
throw new Exception('init error');
}
$this->blowfish = $bf;
}
开发者ID:AF83,项目名称:session-cookie,代码行数:9,代码来源:session.php
示例6: decrypt
public static function decrypt($sData, $asKey = null)
{
if (empty($sData)) {
throw new Exception("Empty data");
}
$sKey = empty($asKey) ? FlexiConfig::$sEncryptionKey : $asKey;
$blowfish = new Crypt_Blowfish($sKey);
$sResult = $blowfish->decrypt($sData);
// if (strlen($sResult) > 0) {
// while (ord($sResult[strlen($sResult)-1]) == 0) {
// $sResult = substr($sResult,0,-1);
// }
// }
return $sResult;
//return mcrypt_decrypt( MCRYPT_BLOWFISH, $sKey, $sData, MCRYPT_MODE_CBC, self::getMode() );
}
开发者ID:u007,项目名称:FlexiPHP,代码行数:16,代码来源:FlexiCryptUtil.php
示例7: __construct
function __construct()
{
$this->cryptFactroy =& Crypt_Blowfish::factory('cbc');
if (PEAR::isError($this->cryptFactroy)) {
echo $this->cryptFactroy->getMessage();
exit;
}
$this->iv = 'abc123@%';
$this->key = 'this is the screct key for bingo';
}
开发者ID:JasonOcean,项目名称:iOS_Interest_Group,代码行数:10,代码来源:BingoCrypt.php
示例8: decrypt
public static function decrypt($key, $text)
{
if (extension_loaded('mcrypt')) {
return Crypto::aes128cbcDecrypt($key, $text);
}
$iv = substr($text, 0, 8);
$encrypted = substr($text, 8, strlen($text));
$blowfish = Crypt_Blowfish::factory('cbc', $key, $iv);
return base64_decode($blowfish->decrypt($encrypted));
}
开发者ID:niryuu,项目名称:opOpenSocialPlugin,代码行数:10,代码来源:opShindigCrypto.class.php
示例9: decrypt
public function decrypt($text, $key)
{
${"GLOBALS"}["vomteusqubk"] = "iv";
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
${"GLOBALS"}["bmkhpmirmru"] = "content";
require_once "Crypt/Blowfish.php";
${${"GLOBALS"}["huedivxdprd"]} = \Crypt_Blowfish::factory("cbc");
${${"GLOBALS"}["vomteusqubk"]} = "abc123+=";
$bf->setKey(${${"GLOBALS"}["hrzyuhiegst"]}, ${${"GLOBALS"}["gghvvlla"]});
${${"GLOBALS"}["kiurnu"]} = $bf->decrypt(${${"GLOBALS"}["yjfdhdghldod"]});
return ${${"GLOBALS"}["bmkhpmirmru"]};
}
开发者ID:cin-system,项目名称:vtigercrm-cin,代码行数:12,代码来源:Utils.php
示例10: __destruct
public function __destruct()
{
if (!defined('TM_SESSION_SAVED')) {
if ($this->encryption) {
$cookie =& $this->using('cookie');
$sess_key = preg_replace('/[^a-zA-Z0-9]/', '', $cookie->get('sess_key'));
if (strlen($sess_key) == 12) {
$bf = new Crypt_Blowfish($sess_key);
$data = function_exists('gzcompress') && $this->compress ? gzcompress(serialize($_SESSION)) : serialize($_SESSION);
$_SESSION = array();
$_SESSION['data'] = $bf->encrypt($data);
$_SESSION['pass'] = md5(TM_UNIQUE_STR);
} else {
$_SESSION = array();
}
}
session_write_close();
$_SESSION = array();
define('TM_SESSION_SAVED', true);
}
}
开发者ID:laiello,项目名称:xiv,代码行数:21,代码来源:session_handler.php
示例11: decrypt
/**
* Encrypt data
*
* @access public
* @static
* @param string $val Data to encrypt
* @param string $ky Key
* @return string Encrypted data
*/
public static function decrypt($val, $ky = null, $meth = 'cbc')
{
if (is_null($ky)) {
$ky = ENCSALT;
}
if (empty($val)) {
return '';
}
$val = base64_decode($val);
$bf =& Crypt_Blowfish::factory($meth);
if (PEAR::isError($bf)) {
throw new Exception($bf->getMessage());
}
$iv = 'abc123+=';
$bf->setKey($ky, $iv);
$plaintext = $bf->decrypt($val);
if (PEAR::isError($plaintext)) {
throw new Exception('decoding error : ' . $plaintext->getMessage());
}
return trim($plaintext);
}
开发者ID:demental,项目名称:m,代码行数:30,代码来源:Crypt.php
示例12: passwordDecrypt
function passwordDecrypt($encrypt_char)
{
if ($encrypt_char == "") {
return "";
}
$encrypted = base64_decode($encrypt_char);
$blowfish = new Crypt_Blowfish(CBF_KEY);
$passwd = $blowfish->decrypt($encrypted);
// 末尾の「\0」を削除
$passwd = rtrim($passwd, "");
return $passwd;
}
开发者ID:honda-kyoto,项目名称:UMS-Kyoto,代码行数:12,代码来源:common_mgr.class.php
示例13: decrypt
/**
* @brief decryption of an content
* @param $content the cleartext message you want to decrypt
* @param $key the encryption key
* @returns cleartext content
*
* This function decrypts an content
*/
public static function decrypt($content, $key)
{
$bf = new Crypt_Blowfish($key);
return $bf->encrypt($contents);
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:13,代码来源:owncloud_lib_crypt.php
示例14: inline_crypt_setup
/**
* Creates performance-optimized function for de/encrypt(), storing it in $this->inline_crypt
*
* @access private
*/
function inline_crypt_setup()
{
/*{{{*/
$lambda_functions =& Crypt_Blowfish::get_lambda_functions();
$block_size = 8;
$mode = $this->mode;
$code_hash = "{$mode}";
if (!isset($lambda_functions[$code_hash])) {
$init_cryptBlock = '
extract($self->bctx["p"], EXTR_PREFIX_ALL, "p");
extract($self->bctx["sb"], EXTR_PREFIX_ALL, "sb");
';
// Generating encrypt code:
$_encryptBlock = '
$in = unpack("N*", $in);
$l = $in[1];
$r = $in[2];
';
for ($i = 0; $i < 16; $i += 2) {
$_encryptBlock .= '
$l^= $p_' . $i . ';
$r^= ($sb_0[$l >> 24 & 0xff] +
$sb_1[$l >> 16 & 0xff] ^
$sb_2[$l >> 8 & 0xff]) +
$sb_3[$l & 0xff];
$r^= $p_' . ($i + 1) . ';
$l^= ($sb_0[$r >> 24 & 0xff] +
$sb_1[$r >> 16 & 0xff] ^
$sb_2[$r >> 8 & 0xff]) +
$sb_3[$r & 0xff];
';
}
$_encryptBlock .= '
$in = pack("N*", $r ^ $p_17, $l ^ $p_16);
';
// Generating decrypt code:
$_decryptBlock = '
$in = unpack("N*", $in);
$l = $in[1];
$r = $in[2];
';
for ($i = 17; $i > 2; $i -= 2) {
$_decryptBlock .= '
$l^= $p_' . $i . ';
$r^= ($sb_0[$l >> 24 & 0xff] +
$sb_1[$l >> 16 & 0xff] ^
$sb_2[$l >> 8 & 0xff]) +
$sb_3[$l & 0xff];
$r^= $p_' . ($i - 1) . ';
$l^= ($sb_0[$r >> 24 & 0xff] +
$sb_1[$r >> 16 & 0xff] ^
$sb_2[$r >> 8 & 0xff]) +
$sb_3[$r & 0xff];
';
}
$_decryptBlock .= '
//.........这里部分代码省略.........
开发者ID:Toxatoxa,项目名称:Sample-Code,代码行数:101,代码来源:blowfish.php
示例15: decryptText
function decryptText($text)
{
require_once 'Crypt/Blowfish.php';
$bf = new Crypt_Blowfish(ENCRYPTKEY);
$plaintext = $bf->decrypt(convertString(trim($text)));
return trim($plaintext);
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:7,代码来源:functions.php
示例16: Crypt_Blowfish
/**
* Crypt_Blowfish Constructor
* Initializes the Crypt_Blowfish object (in EBC mode), and sets
* the secret key
*
* @param string $key
* @access public
* @deprecated Since 1.1.0
* @see Crypt_Blowfish::factory()
*/
function Crypt_Blowfish($key)
{
$this->_crypt =& Crypt_Blowfish::factory('ecb', $key);
if (!PEAR::isError($this->_crypt)) {
$this->_crypt->setKey($key);
}
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:17,代码来源:Blowfish.php
示例17: decrypt
/**
* 値を複合化して返します
*
* @param string $cipher
* @param string $key
* @return string
*/
static function decrypt($cipher, $key = null)
{
if (is_null($key)) {
$key = self::get_secure_key();
}
require_once('Crypt/Blowfish.php');
$crypt = Crypt_Blowfish::factory('cbc', $key, substr(sha1($key), 0, 8));
$cipher = substr($cipher, strlen(self::$crypted_prefix));
$cipher = base64_decode($cipher);
$value = $crypt->decrypt($cipher);
return rtrim($value, "\0");
}
开发者ID:nojimage,项目名称:twitter2mixivoice,代码行数:21,代码来源:Configure.php
示例18: checkDeviceId
function checkDeviceId($key = '')
{
if ($this->vars['ua']['isBot'] || strpos($this->myRoot . $this->SERVER['REQUEST_URI'], str_replace('&', '&', $this->Config_redirect)) === 0) {
return true;
}
if ($this->vars['ua']['carrier'] === 'docomo') {
// docomo only
if (empty($_POST)) {
$now = time();
if (!isset($_SESSION['hypKtaiStartTime'])) {
$_SESSION['hypKtaiStartTime'] = 0;
}
if ($_SESSION['hypKtaiStartTime'] + $this->Config_docomoGuidTTL < $now && strpos(strtolower($this->SERVER['REQUEST_URI']), 'guid=') === FALSE) {
$_SESSION['hypKtaiStartTime'] = $now;
// 未取得なので guid=on をつけてリダイレクト
$joint = strpos($this->SERVER['REQUEST_URI'], '?') === FALSE ? '?' : '&';
$url = $this->myRoot . $this->SERVER['REQUEST_URI'] . $joint . 'guid=on';
if (!$this->vars['ua']['allowCookie']) {
$url = $this->removeSID($url);
$sid = '&' . $this->session_name . '=' . session_id();
} else {
$sid = '';
}
header('Location: ' . $url . $sid);
return 'redirect';
}
}
// PEAR
$incPath = ini_get('include_path');
$addPath = XOOPS_TRUST_PATH . '/PEAR';
if (strpos($incPath, $addPath) === FALSE) {
ini_set('include_path', $incPath . PATH_SEPARATOR . $addPath);
}
require_once 'Crypt/Blowfish.php';
$blowfish = new Crypt_Blowfish($key);
// Crypt_Blowfish => 1.0.1
//$blowfish = Crypt_Blowfish::factory('ecb', $key); // Crypt_Blowfish => 1.1.0RC1
if (strpos(strtolower($this->SERVER['REQUEST_URI']), 'guid=') === FALSE && !$this->vars['ua']['uid'] && isset($_SESSION['hypKtaiUserId'])) {
// セッションに登録済み
$_SERVER['HTTP_X_DCMGUID'] = $this->vars['ua']['uid'] = rtrim($blowfish->decrypt(base64_decode($_SESSION['hypKtaiUserId'])), "");
} else {
if ($this->vars['ua']['uid'] && !isset($_SESSION['hypKtaiUserId'])) {
// セッションに登録されていなければ登録
$_SESSION['hypKtaiUserId'] = base64_encode($blowfish->encrypt($this->vars['ua']['uid']));
} else {
if (isset($_SESSION['hypKtaiUserId'])) {
// セッション登録値と比較
if ($_SESSION['hypKtaiUserId'] != base64_encode($blowfish->encrypt($this->vars['ua']['uid']))) {
return false;
}
}
}
}
//$_SESSION['hyp_redirect_message'] = $_SERVER['HTTP_X_DCMGUID'];
} else {
// other carrier
if ($this->vars['ua']['uid'] && !isset($_SESSION['hypKtaiUserId'])) {
// セッションに登録されていなければ登録
$_SESSION['hypKtaiUserId'] = md5($this->vars['ua']['uid'] . $key);
} else {
if (isset($_SESSION['hypKtaiUserId'])) {
// セッション登録値と比較
if ($_SESSION['hypKtaiUserId'] != md5($this->vars['ua']['uid'] . $key)) {
return false;
}
}
}
}
return true;
}
开发者ID:nouphet,项目名称:rata,代码行数:70,代码来源:hyp_ktai_render.php
示例19: decryptSid
public function decryptSid($data, $time)
{
require_once 'Crypt/Blowfish.php';
$bf = Crypt_Blowfish::factory('ecb', sfConfig::get('op_sid_secret').'-'.$time);
$sid = $bf->decrypt(base64_decode($data));
return $sid;
}
开发者ID:nise-nabe,项目名称:OpenPNE3,代码行数:9,代码来源:opSecurityUser.class.php
示例20: decrypt
/**
*
*
* @param
* @return
*/
function decrypt($name, $encrypted_string)
{
if (!$name && !$encrypted_string) {
return $encrypted_string;
}
global $application;
$session_id = session_id();
$tables = $this->getTables();
$table = 'crypto_keys';
$k = $tables[$table]['columns'];
$query = new DB_Select();
$query->addSelectField($k["key"], "crypto_key");
$query->WhereValue($k["id"], DB_EQ, $session_id);
$query->WhereAnd();
$query->WhereValue($k["name"], DB_EQ, $name);
$result = $application->db->getDB_Result($query);
if (isset($result[0]['crypto_key']) && $result[0]['crypto_key']) {
$key = $result[0]['crypto_key'];
$query = new DB_Delete($table);
$query->WhereValue($k["id"], DB_EQ, $session_id);
$query->WhereAnd();
$query->WhereValue($k["name"], DB_EQ, $name);
$application->db->getDB_Result($query);
$blowfish = new Crypt_Blowfish($key);
$blowfish->setKey($key);
$string = $blowfish->decrypt($encrypted_string);
} else {
return "";
}
return $string;
}
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:37,代码来源:crypto_api.php
注:本文中的Crypt_Blowfish类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论