本文整理汇总了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'];
}
}