LFlow/LFlow.UserManagement/Util/PasswordHelper.cs

21 lines
521 B
C#

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();
}
}
}