Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Dev! I develop a login and signup pages for my website in asp.net c#. i encrypt password using hasing md5 technique, Now i want to decrypt it but i can't can you help me out!!


i encrypt password through below function

What I have tried:

public string encryption(String password)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] encrypt;
UTF8Encoding encode = new UTF8Encoding();
//encrypt the given password string into Encrypted data
encrypt = md5.ComputeHash(encode.GetBytes(password));
StringBuilder encryptdata = new StringBuilder();
//Create a new string by using the encrypted data
for (int i = 0; i < encrypt.Length; i++)
{
encryptdata.Append(encrypt[i].ToString());
}
return encryptdata.ToString();
}






protected void Button1_Click(object sender, EventArgs e)
{

using (var db = new schoolEntities())
{

registrationtbl u = new registrationtbl();
u.stdEmail = TextBox1.Text;
u.sdPassword = encryption(TextBox2.Text);
db.registrationtbls.Add(u);
db.SaveChanges();
Response.Write("added successfully");


}
}
Posted
Updated 17-May-21 21:56pm
Comments
Dave Kreskowiak 18-May-21 10:16am    
MD5 should NEVER be used to hash passwords. It's considered broken because, today, it's easy (in terms of time) to figure out a string that will generate the same hash.

You can't - that's the whole idea.
A Hash code (like MD5 or SHA) is not encryption: it can't be reversed: Decrypting MD5 and SHA: Why You Can't Do It[^]
 
Share this answer
 
v2
Comments
Jjopkjj 18-May-21 2:46am    
so we can't decrypt hash or md5 encrypted password??
OriginalGriff 18-May-21 2:58am    
No - the link explains why.
 
Share this answer
 
Quote:
Now i want to decrypt it but i can't can you help me out!!

No, nobody can help you because MD5 hashing is not encryption.
MD5 - Wikipedia[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900