Use HashPasswordForStoringInConfigFile() static method of FormsAuthentication class which is under the System.Web.Security namespace to Encrypt your password string into 32 char encrypted string... you can use MD5 algorithm as well as SSH1 algorithm to encrypt it...
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(LoginUser.Password, "MD5");
only one disadvantage is that there isn't any other method to decrypt your encrypted string...
For that you have to use other method or you can use any web service from the net that help you to encypt or decrypt your string... There are many web service are there......
Or you can develop your own algorithm to encrypt or decrypt string.. yes It has less security than the other algorithm, but you can do like following....
private string encrypt(string str)
{
string _result = string.Empty;
char[] temp = str.ToCharArray();
foreach (var _singleChar in temp)
{
var i = (int)_singleChar;
i = i - 2;
_result += (char)i;
}
return _result;
}
private string decrypt(string str)
{
string _result = string.Empty;
char[] temp = str.ToCharArray();
foreach (var _singleChar in temp)
{
var i = (int)_singleChar;
i = i + 2;
_result += (char)i;
}
return _result;
}