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 *

Captcha *