SboxSuperuser/Core/Commands/RequestFingerprint.cs

A small static helper in the SboxSuperuser command layer. Serializes a command name plus its argument list to JSON and returns the SHA256 of that JSON as an uppercase hex string, so identical requests can be fingerprinted or compared.

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 ) ) );
	}
}