Generate the hash code of the password : SHA1Managed « Security « C# / CSharp Tutorial






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








35.11.SHA1Managed
35.11.1.Generate the hash code of the file's contents
35.11.2.Generate the hash code of the password
35.11.3.Produce a SHA1 hash