本文整理汇总了PHP中Encryption::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Encryption::__construct方法的具体用法?PHP Encryption::__construct怎么用?PHP Encryption::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encryption
的用法示例。
在下文中一共展示了Encryption::__construct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
*
* @param string $cipher
* @param string $password
* @param string $salt
* @param int $ivMaxChars null if you want a full iv. If you provide a number, the rest of the iv will be padded.
* @param bool $useMd5NotRandom If true, the IV will be extracted from md5 of the data.
* @param int $nonceChars
* @param int $cipherIvLength If null, the iv length gets calculated with openssl_cipher_iv_length()
* @param string $serializationFormat
*/
public function __construct($cipher, $password, $salt, $ivMaxChars = 4, $useMd5NotRandom = false, $nonceChars = 5, $cipherIvLength = null, $serializationFormat = self::SERIALIZE_JSON)
{
parent::__construct($password, $salt, $serializationFormat);
$this->cipher = $cipher;
$cipherIvLength = (int) $cipherIvLength;
$this->cipherIvLength = $cipherIvLength ? (int) $cipherIvLength : openssl_cipher_iv_length($this->cipher);
$this->ivMaxChars = $ivMaxChars === null ? null : (int) $ivMaxChars;
$this->nonceChars = (int) $nonceChars;
$this->useMd5NotRandom = $useMd5NotRandom;
}