本文整理匯總了PHP中TCPDF_STATIC::_RC4方法的典型用法代碼示例。如果您正苦於以下問題:PHP TCPDF_STATIC::_RC4方法的具體用法?PHP TCPDF_STATIC::_RC4怎麽用?PHP TCPDF_STATIC::_RC4使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TCPDF_STATIC
的用法示例。
在下文中一共展示了TCPDF_STATIC::_RC4方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _Ovalue
/**
* Compute O value (used for encryption)
* @return string O value
* @protected
* @since 2.0.000 (2008-01-02)
* @author Nicola Asuni
*/
protected function _Ovalue()
{
if ($this->encryptdata['mode'] < 3) {
// RC4-40, RC4-128, AES-128
$tmp = TCPDF_STATIC::_md5_16($this->encryptdata['owner_password']);
if ($this->encryptdata['mode'] > 0) {
for ($i = 0; $i < 50; ++$i) {
$tmp = TCPDF_STATIC::_md5_16($tmp);
}
}
$owner_key = substr($tmp, 0, $this->encryptdata['Length'] / 8);
$enc = TCPDF_STATIC::_RC4($owner_key, $this->encryptdata['user_password'], $this->last_enc_key, $this->last_enc_key_c);
if ($this->encryptdata['mode'] > 0) {
$len = strlen($owner_key);
for ($i = 1; $i <= 19; ++$i) {
$ek = '';
for ($j = 0; $j < $len; ++$j) {
$ek .= chr(ord($owner_key[$j]) ^ $i);
}
$enc = TCPDF_STATIC::_RC4($ek, $enc, $this->last_enc_key, $this->last_enc_key_c);
}
}
return $enc;
} elseif ($this->encryptdata['mode'] == 3) {
// AES-256
$seed = TCPDF_STATIC::_md5_16(TCPDF_STATIC::getRandomSeed());
// Owner Validation Salt
$this->encryptdata['OVS'] = substr($seed, 0, 8);
// Owner Key Salt
$this->encryptdata['OKS'] = substr($seed, 8, 16);
return hash('sha256', $this->encryptdata['owner_password'] . $this->encryptdata['OVS'] . $this->encryptdata['U'], true) . $this->encryptdata['OVS'] . $this->encryptdata['OKS'];
}
}