You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
538 B
C#
19 lines
538 B
C#
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace Khd.Core.Library.Extensions
|
|
{
|
|
public static class StringExtensions
|
|
{
|
|
public static string GetMd5(this string value)
|
|
{
|
|
using var md5Hash = MD5.Create();
|
|
var data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(value));
|
|
var sBuilder = new StringBuilder();
|
|
foreach (var b in data) sBuilder.Append(b.ToString("x2"));
|
|
|
|
var hash = sBuilder.ToString();
|
|
return hash;
|
|
}
|
|
}
|
|
} |