LFlow/LFlow.UserManagement/Util/PasswordHelper.cs

21 lines
521 B
C#
Raw Normal View History

2024-10-29 15:46:44 +08:00
using System.Security.Cryptography;
using System.Text;
namespace LFlow.UserManagement.Util
{
public class PasswordHelper
{
public static string HashPassword(string password)
{
byte[] data = Encoding.Default.GetBytes(password);
byte[] hashData = MD5.HashData(data);
StringBuilder sb = new();
foreach (byte b in hashData)
{
sb.Append(b.ToString("x2"));
}
return sb.ToString();
}
}
}