This commit is contained in:
masoodafar-web
2025-11-12 23:17:56 +03:30
parent 2fac0f4922
commit 0adb0713f3
7 changed files with 3205 additions and 2812 deletions

View File

@@ -0,0 +1,18 @@
namespace CMSMicroservice.Application.Common.Interfaces;
public interface IHashService
{
// Computes a deterministic SHA-256 hex string for the given input (legacy helper)
string ComputeSha256Hex(string input);
// Compares plain input with a stored hex hash (case-insensitive) (legacy helper)
bool VerifySha256Hex(string input, string? expectedHexHash);
// Computes HMAC-SHA256 hex using a provided secret (for OTP and similar)
string ComputeHmacSha256Hex(string input, string secret);
// Verifies input against expected HMAC-SHA256 hex using the secret
bool VerifyHmacSha256Hex(string input, string? expectedHexHash, string secret);
// Creates a salted password hash using PBKDF2; returns an encoded string containing algorithm params and salt
string HashPassword(string password);
// Verifies a password against the stored hash; supports both PBKDF2 format and legacy SHA-256 hex
bool VerifyPassword(string password, string? storedHash);
}