本文整理汇总了PHP中Crypt::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt::with方法的具体用法?PHP Crypt::with怎么用?PHP Crypt::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crypt
的用法示例。
在下文中一共展示了Crypt::with方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cryptValue
/**
* Encrypt value according to the field crypt property
*
* @param string $value
* @return string
*/
public function cryptValue($value)
{
load_class('Q\\Crypt');
return empty($this['crypt']) || !isset($value) ? $value : Crypt::with($this['crypt'])->encrypt($value);
}
示例2: checksum
/**
* Return a checksum hash to identify the user and session.
*
* @param string $salt
* @return string
*/
public function checksum($salt = null)
{
if (!isset($this->info) && !$this->getInfo()) {
return null;
}
if (is_string($this->store)) {
$this->store = extract_dsn($this->store);
}
if (!$this->checksumCrypt instanceof Crypt) {
$this->checksumCrypt = Crypt::with($this->checksumCrypt);
}
if (empty($this->checksumCrypt->secret) && !$this->checksumPassword) {
throw new Exception("To create a checksum, either the password needs to be included or a secret key needs to be used.");
}
return $this->checksumCrypt->encrypt((isset($this->info['uid']) ? $this->info['uid'] : $this->info['username']) . ($this->checksumPassword ? $this->getUser()->getPassword() : null) . ($this->checksumClientIp ? HTTP::getClientRoute() : null) . ($this->store['driver'] == 'session' ? session_id() : null), $salt);
}