1
This commit is contained in:
20
Yes.Domain/Core/Extensions/PasswordExtensions.cs
Normal file
20
Yes.Domain/Core/Extensions/PasswordExtensions.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace Yes.Domain.Core.Extensions
|
||||
{
|
||||
public static class PasswordExtensions
|
||||
{
|
||||
public static string ToMd5(this string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
var result = md5.ComputeHash(Encoding.UTF8.GetBytes(input));
|
||||
var strResult = BitConverter.ToString(result);
|
||||
return strResult.Replace("-", "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user