This commit is contained in:
2026-02-12 21:53:26 +08:00
parent 77db20dc38
commit b96d895809
339 changed files with 46655 additions and 46657 deletions
+21 -21
View File
@@ -1,21 +1,21 @@
using System.Security.Cryptography;
using System.Text;
namespace IM_API.Tools
{
public static class PasswordHasher
{
public static string HashPassword(string password)
{
using var sha256 = SHA256.Create();
var hashedBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(password));
return Convert.ToBase64String(hashedBytes);
}
public static bool VerifyPassword(string password, string hashedPassword)
{
var hashedInput = HashPassword(password);
return hashedInput == hashedPassword;
}
}
}
using System.Security.Cryptography;
using System.Text;
namespace IM_API.Tools
{
public static class PasswordHasher
{
public static string HashPassword(string password)
{
using var sha256 = SHA256.Create();
var hashedBytes = sha256.ComputeHash(Encoding.UTF8.GetBytes(password));
return Convert.ToBase64String(hashedBytes);
}
public static bool VerifyPassword(string password, string hashedPassword)
{
var hashedInput = HashPassword(password);
return hashedInput == hashedPassword;
}
}
}