Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Test
- {
- string GetSha256(string INPUT, Encoding encoding = null)
- {
- if (encoding == null) encoding = new UTF8Encoding(false);
- var sha = System.Security.Cryptography.SHA256.Create();
- byte[] inputBytes = Encoding.UTF8.GetBytes(INPUT);
- byte[] hash = sha.ComputeHash(inputBytes);
- string sha256 = string.Empty;
- for (int i = 0; i < hash.Length; i++)
- sha256 += hash[i].ToString("X2");
- return sha256;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement