23 lines
682 B
C#
23 lines
682 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace iPackage.Extensions
|
|
{
|
|
public static class SecurityHelper
|
|
{
|
|
public static string GetSha256Hash(string input)
|
|
{
|
|
//using (var sha256 = new SHA256CryptoServiceProvider())
|
|
using (var sha256 = SHA256.Create())
|
|
{
|
|
var byteValue = Encoding.UTF8.GetBytes(input);
|
|
var byteHash = sha256.ComputeHash(byteValue);
|
|
return Convert.ToBase64String(byteHash);
|
|
//return BitConverter.ToString(byteHash).Replace("-", "").ToLower();
|
|
}
|
|
}
|
|
}
|
|
}
|