Mega Code Archive

 
Categories / C# Tutorial / Security
 

Generate the hash code of the password

using System; using System.Text; using System.Security.Cryptography; class MainClass {     public static void Main(string[] args)     {         HashAlgorithm hashAlg = new SHA1Managed();         using (hashAlg)         {             byte[] pwordData = Encoding.Default.GetBytes("password");             byte[] hash = hashAlg.ComputeHash(pwordData);             Console.WriteLine(BitConverter.ToString(hash));         }     } } 5B-AA-61-E4-C9-B9-3F-3F-06-82-25-0B-6C-F8-33-1B-7E-E6-8F-D8