Decrypt password in asp.net

Posted by Shoyeb under ASP.NET on 11/13/2013 | Points: 10 | Views : 8041 | Status : [Member] | Replies : 3
Hi all ,

i am using
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("abc", "SHA1");

for paswword encryption , it convert to some encrypted format like

84A516841BA77A5B4648DE2CD0DFCB30EA46DBB4

now how can i recover from this encrypted code to back "abc" ..


thanx




Responses

Posted by: Bandi on: 11/13/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link once http://forums.asp.net/t/1553518.aspx
Sample code for encryption and decryption code...
using System.Text;

private string Encryptdata(string password)
{
string strmsg = string.Empty;
byte[] encode = new byte[password.Length];
encode = Encoding.UTF8.GetBytes(password);
strmsg = Convert.ToBase64String(encode);
return strmsg;
}

private string Decryptdata(string encryptpwd)
{
string decryptpwd = string.Empty;
UTF8Encoding encodepwd = new UTF8Encoding();
Decoder Decode = encodepwd.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(encryptpwd);
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);
decryptpwd = new String(decoded_char);
return decryptpwd;
}



string strpassword = Encryptdata(TextBox1.Text); //Enc

string strpassword = Decryptdata(TextBox1.Text); //Dec


Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Shoyeb, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 11/13/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer these links
http://www.codeproject.com/Questions/195713/how-to-encrypt-and-decrypt-password-in-asp-net
http://davepranav.wordpress.com/2009/11/11/encryption-and-decryption-using-utf8encoding-md5-and-sha1-algorithm/

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Shoyeb, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 11/14/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Click on "Mark as Answer " if you got solution

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Shoyeb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response