using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace WebAPIBase.Utils
{
    public static class HashUtil
    {
        public static string GetSha256FromString(string strData)
        {
            var message = Encoding.ASCII.GetBytes(strData);
            var hashString = new SHA256Managed();

            var hashValue = hashString.ComputeHash(message);
            return hashValue.Aggregate("", (current, x) => current + $"{x:x2}");
        }
    }
}