search and ai stabilization work, localization stablized.

This commit is contained in:
master
2026-02-24 23:29:36 +02:00
parent 4f947a8b61
commit b07d27772e
766 changed files with 55299 additions and 3221 deletions

View File

@@ -12,6 +12,7 @@ using System.IO;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using static StellaOps.Localization.T;
namespace StellaOps.Cryptography;
@@ -136,7 +137,7 @@ public sealed class DefaultCryptoHmac : ICryptoHmac
{
if (string.IsNullOrWhiteSpace(purpose))
{
throw new ArgumentException("Purpose cannot be null or empty.", nameof(purpose));
throw new ArgumentException(_t("crypto.hash.purpose_required"), nameof(purpose));
}
var profile = GetActiveProfile();
@@ -153,7 +154,7 @@ public sealed class DefaultCryptoHmac : ICryptoHmac
"HMAC-SHA512" => 64,
"HMAC-GOST3411" => 32, // GOST R 34.11-2012 Stribog-256
"HMAC-SM3" => 32,
_ => throw new InvalidOperationException($"Unknown HMAC algorithm '{algorithm}'.")
_ => throw new InvalidOperationException(_t("crypto.hmac.algorithm_unknown", algorithm))
};
}
@@ -170,7 +171,7 @@ public sealed class DefaultCryptoHmac : ICryptoHmac
"HMAC-SHA512" => ComputeHmacSha512(key, data),
"HMAC-GOST3411" => ComputeHmacGost3411(key, data),
"HMAC-SM3" => ComputeHmacSm3(key, data),
_ => throw new InvalidOperationException($"Unsupported HMAC algorithm '{algorithm}'.")
_ => throw new InvalidOperationException(_t("crypto.hmac.algorithm_unsupported", algorithm))
};
}
@@ -183,7 +184,7 @@ public sealed class DefaultCryptoHmac : ICryptoHmac
"HMAC-SHA512" => await ComputeHmacShaStreamAsync(HashAlgorithmName.SHA512, key, stream, cancellationToken).ConfigureAwait(false),
"HMAC-GOST3411" => await ComputeHmacGost3411StreamAsync(key, stream, cancellationToken).ConfigureAwait(false),
"HMAC-SM3" => await ComputeHmacSm3StreamAsync(key, stream, cancellationToken).ConfigureAwait(false),
_ => throw new InvalidOperationException($"Unsupported HMAC algorithm '{algorithm}'.")
_ => throw new InvalidOperationException(_t("crypto.hmac.algorithm_unsupported", algorithm))
};
}
@@ -237,7 +238,7 @@ public sealed class DefaultCryptoHmac : ICryptoHmac
"SHA256" => (HMAC)new HMACSHA256(key.ToArray()),
"SHA384" => new HMACSHA384(key.ToArray()),
"SHA512" => new HMACSHA512(key.ToArray()),
_ => throw new InvalidOperationException($"Unsupported hash algorithm '{name}'.")
_ => throw new InvalidOperationException(_t("crypto.hash.algorithm_unsupported", name))
};
return await hmac.ComputeHashAsync(stream, cancellationToken).ConfigureAwait(false);