Encrypt and Decrypt Password in ASP.Net

Password Encryption and Decryption.

  • Encrypt password before insert to database.

    byte[] b = System.Text.ASCIIEncoding.ASCII.GetBytes(txtpass.Text);

    string encryptedpassword = Convert.ToBase64String(b);

     

  • Decrypt Password before Login.

    byte[] bb = Convert.FromBase64String(UserDT.Rows[i]["Password"].ToString())

    string getoriginalpass = System.Text.ASCIIEncoding.ASCII.GetString(bb);

Leave a Reply

Your email address will not be published. Required fields are marked *

4 + 9 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">