public static function ivsize(string $cipher): int
    {
        $ret = \openssl_cipher_iv_length($cipher);

        if ($ret === false) {
            throw new \Exception("Failed to determine correct IV size.");
        }

        return $ret;
    }