eft-lootvalueex/Plugin/Utils/HashingUtils.cs

28 lines
729 B
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace LootValueEX.Utils
{
internal class HashingUtils
{
internal static string ConvertToSha256(string value)
{
StringBuilder sb = new StringBuilder();
using (var hash = SHA256.Create())
{
Encoding encoding = Encoding.UTF8;
byte[] result = hash.ComputeHash(encoding.GetBytes(value));
foreach (byte b in result)
{
sb.Append(b.ToString("x2"));
}
}
return sb.ToString();
}
}
}