/** * * @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; }