22 lines
572 B
C#
22 lines
572 B
C#
using System;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace BookmarkManager
|
|
{
|
|
public class Crypto
|
|
{
|
|
public static string GetSHA256Hash(string text)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(text)) return string.Empty;
|
|
|
|
using (var sha = SHA256.Create())
|
|
{
|
|
byte[] hash = sha.ComputeHash(Encoding.UTF8.GetBytes(text));
|
|
|
|
return BitConverter.ToString(hash).Replace("-", string.Empty) + "+" + text.Length.ToString();
|
|
}
|
|
}
|
|
|
|
}
|
|
} |