A small utility that computes a deterministic fingerprint for a command and its arguments. It JSON-serializes an object with fields command and arguments, computes the SHA-256 hash of the UTF-8 bytes, and returns the hex string.
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
namespace SboxSuperuser.Core.Commands;
internal static class RequestFingerprint
{
internal static string Compute( string command, IReadOnlyList<string> arguments )
{
var json = JsonSerializer.Serialize( new { command, arguments } );
return Convert.ToHexString( SHA256.HashData( Encoding.UTF8.GetBytes( json ) ) );
}
}