1 using System.Security.Cryptography; 2 3 SHA256 mySHA256 = SHA256Managed.Create(); 4 byte[] ok = mySHA256.ComputeHash(System.Text.Encoding.Default.GetBytes(resp)); 5 System.Diagnostics.Debug.WriteLine(PrintByteArray(ok)); 6 7 private string PrintByteArray(byte[] array) 8 { 9 string ret = ""; 10 for (int i = 0; i < array.Length; i++) 11 { 12 ret += String.Format("{0:X2}", array[i]); 13 //if ((i % 4) == 3) ret += " "; 14 } 15 return ret; 16 }
resp is a string.