Sic.Framework/Sicentury.Core/Extensions/Sha256Extenstion.cs

20 lines
523 B
C#
Raw Normal View History

2023-04-13 11:51:03 +08:00
using System;
using System.Security.Cryptography;
using System.Text;
namespace Sicentury.Core.Extensions
{
public static class Sha256Extension
{
public static string Sha256Encoding(this string strSource)
{
using (var sha = SHA256.Create())
{
var hashBytes = sha.ComputeHash(Encoding.UTF8.GetBytes(strSource));
var hashStr = BitConverter.ToString(hashBytes).Replace("-", "");
return hashStr;
}
}
}
}