Password Encryption Using ASP.Net

Password Encryption can be used for encrypting password. Here in this article I am going to explain how you can create the hashed passwords. This method can be used for storing passwords in the credentials section of a database or inside an XML file.

Some of commonly used Hash Encryption Algorithms are ‘MD5‘ and ‘SHA-1

SHA-1 (Secure Hash Algorithm 1) is slower than MD5 but the message digest is larger, which makes it more resistant to brute force attacks. Therefore, it is recommended that Secure Hash Algorithm is preferred to MD5 for all of your digest needs.

Creating Hashed Passwords Using “SHA-1” (Secure Hash Algoritham)

  • Source Code “VB.NET”

    Dim strEncryptPassword As String
    strEncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, “sha1”)

  • Source Code “C#”

    {
    string strEncryptPassword;
    strEncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, “sha1”);
    }

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s