$cipher, 'iv' => base64_encode($iv), ]; } function decryptText(string $cipher, string $iv, string $key): string|false { return openssl_decrypt($cipher, 'AES-256-CBC', $key, 0, base64_decode($iv)); } function generateId(): string { return bin2hex(random_bytes(16)); } function jsonResponse(array $data, int $status = 200): void { http_response_code($status); header('Content-Type: application/json'); echo json_encode($data); exit; }