CSharp examples for System:Byte Array
Hash To Byte array Buffer
using System.Security.Cryptography; using System.IO;/*from ww w. java 2 s . co m*/ using System; public class Main{ public static byte[] HashToBuffer(byte[] input) { HashAlgorithm sha = new SHA1CryptoServiceProvider(); return sha.ComputeHash(input); } public static byte[] HashToBuffer(string input) { MemoryStream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream); writer.Write(input); writer.Flush(); stream.Position = 0; HashAlgorithm sha = new SHA1CryptoServiceProvider(); return sha.ComputeHash(stream); } }