首次上传
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user