Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class Test
  2. {
  3. string GetSha256(string INPUT, Encoding encoding = null)
  4. {
  5. if (encoding == null) encoding = new UTF8Encoding(false);
  6. var sha = System.Security.Cryptography.SHA256.Create();
  7. byte[] inputBytes = Encoding.UTF8.GetBytes(INPUT);
  8. byte[] hash = sha.ComputeHash(inputBytes);
  9. string sha256 = string.Empty;
  10. for (int i = 0; i < hash.Length; i++)
  11. sha256 += hash[i].ToString("X2");
  12. return sha256;
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement