You can ecrypt the password as given below:
private string Encrypt_Password(string password)
{
string pwdstring = string.Empty;
byte[] pwd_encode = new byte[password.Length];
pwd_encode = Encoding.UTF8.GetBytes(password);
pwdstring = Convert.ToBase64String(pwd_encode);
return pwdstring;
}
Decode Password:
private string Decrypt_Password(string encryptpassword)
{
string pwdstring = string.Empty;
UTF8Encoding encode_pwd = new UTF8Encoding();
Decoder Decode = encode_pwd.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(encryptpassword);
int charCount = Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
pwdstring = new String(decoded_char);
return pwdstring;
}