Removed comments from function blocks

This commit is contained in:
Khwezi Mngoma
2026-05-31 19:38:03 +02:00
parent 48f4cd45f1
commit c4f73fd999
@@ -35,7 +35,6 @@ public sealed partial class HashService(IHashids hasher, IOptions<HasherSettings
if (string.IsNullOrWhiteSpace(incomingSignature))
return Result.Fail<bool>("Validation failed: Missing signature string parameter.");
// 1. Sort the parameters alphabetically and exclude the signature parameter to prevent recursive checking
var sortedFields = incomingFormData
.Where(field => field.Key != "signature")
.OrderBy(field => field.Key)
@@ -43,19 +42,14 @@ public sealed partial class HashService(IHashids hasher, IOptions<HasherSettings
string payload = string.Join("&", sortedFields);
// 2. Append the secure, passphrase injected into the container pod from your environment variables
if (!string.IsNullOrWhiteSpace(settings.PayfastPassphrase))
{
payload += $"&passphrase={Uri.EscapeDataString(settings.PayfastPassphrase).Replace("%20", "+")}";
}
// 3. Compute localized hex token
var localHashResult = ComputeMd5Hash(payload);
if (!localHashResult.IsSuccess)
return Result.Fail<bool>(localHashResult.Errors);
// 4. Constant-time secure text comparison to fully block timing analysis attacks
bool isValid = string.Equals(localHashResult.Value, incomingSignature, StringComparison.OrdinalIgnoreCase);
return Result.Ok(isValid);