/** * Sets the key length. * * Valid key lengths are 64, 128 and 192 * * @see \phpseclib\Crypt\Base:setKeyLength() * @access public * @param int $length */ function setKeyLength($length) { $length >>= 3; switch (true) { case $length <= 8: $this->key_length = 8; break; case $length <= 16: $this->key_length = 16; break; default: $this->key_length = 24; } parent::setKeyLength($length); }
/** * Sets the key length. * * Valid key lengths are 128 and 192 bits. * * If you want to use a 64-bit key use DES.php * * @see \phpseclib\Crypt\Common\SymmetricKey:setKeyLength() * @access public * @throws \LengthException if the key length is invalid * @param int $length */ function setKeyLength($length) { switch ($length) { case 128: case 192: break; default: throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes 128 or 192 bits are supported'); } parent::setKeyLength($length); }