72) { http_response_code(422); header('Content-Type: text/plain; charset=utf-8'); header('Cache-Control: no-store'); echo 'password exceeds the 72-byte bcrypt limit'; exit; } $hash = password_hash($pass, PASSWORD_BCRYPT, ['cost' => BCRYPT_COST]); if ($hash === false) { http_response_code(500); header('Content-Type: text/plain; charset=utf-8'); header('Cache-Control: no-store'); echo 'hashing failed'; exit; } header('Content-Type: application/json; charset=utf-8'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Pragma: no-cache'); echo json_encode([ 'user' => $user, 'pass_hash' => $hash, 'algo' => password_get_info($hash)['algoName'], 'cost' => BCRYPT_COST, ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), "\n";