bookmark-manager-r4/Classes/Crypto.cs
2021-09-21 13:28:52 +01:00

22 lines
552 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 = new SHA256Managed())
{
byte[] hash = sha.ComputeHash(Encoding.UTF8.GetBytes(text));
return BitConverter.ToString(hash).Replace("-", string.Empty) + "+" + text.Length.ToString();
}
}
}
}