123456789101112131415161718 |
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- namespace 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}");
- }
- }
- }
|