How to decrypt a password
-
Hai all, I'm encrypting the password by using the code as below . Please tell me how to decrypt the same.Please help me..
#region Password Util
/// <summary>
/// Encrypts a string using the SHA256 algorithm.
/// </summary>
public static string HashPassword(string plainMessage)
{
byte[] data = Encoding.UTF8.GetBytes(plainMessage);
using (HashAlgorithm sha = new SHA256Managed())
{
byte[] encryptedBytes = sha.TransformFinalBlock(data, 0, data.Length);
return Convert.ToBase64String(sha.Hash);
}} #endregion protected void btnSubmit\_Click(object sender, EventArgs e) { bo.UserID = txtUserId.Text; Password p = new Password(txtPassword.Text.ToString()); String newpwd = p.SaltedPassword; System.Nullable<int> newsaltkey = p.Salt; bo.Encryptpwd = newpwd; bo.Saltkey = p.Salt; bo.Password = txtPassword.Text; passwordFormat = MembershipPasswordFormat.Hashed; if (passwordFormat == MembershipPasswordFormat.Hashed) bo.Blogpwd = HashPassword(txtPassword.Text); else bo.Blogpwd = txtPassword.Text;
-
Hai all, I'm encrypting the password by using the code as below . Please tell me how to decrypt the same.Please help me..
#region Password Util
/// <summary>
/// Encrypts a string using the SHA256 algorithm.
/// </summary>
public static string HashPassword(string plainMessage)
{
byte[] data = Encoding.UTF8.GetBytes(plainMessage);
using (HashAlgorithm sha = new SHA256Managed())
{
byte[] encryptedBytes = sha.TransformFinalBlock(data, 0, data.Length);
return Convert.ToBase64String(sha.Hash);
}} #endregion protected void btnSubmit\_Click(object sender, EventArgs e) { bo.UserID = txtUserId.Text; Password p = new Password(txtPassword.Text.ToString()); String newpwd = p.SaltedPassword; System.Nullable<int> newsaltkey = p.Salt; bo.Encryptpwd = newpwd; bo.Saltkey = p.Salt; bo.Password = txtPassword.Text; passwordFormat = MembershipPasswordFormat.Hashed; if (passwordFormat == MembershipPasswordFormat.Hashed) bo.Blogpwd = HashPassword(txtPassword.Text); else bo.Blogpwd = txtPassword.Text;
Hash Algorithm are one way encryption.You can not decrypt what you can do,you can encrypt the text and then match with the encrypted one.If you require to decrypt the data then you can use other algorithms...
Cheers!! Brij Check My Latest Article
-
Hai all, I'm encrypting the password by using the code as below . Please tell me how to decrypt the same.Please help me..
#region Password Util
/// <summary>
/// Encrypts a string using the SHA256 algorithm.
/// </summary>
public static string HashPassword(string plainMessage)
{
byte[] data = Encoding.UTF8.GetBytes(plainMessage);
using (HashAlgorithm sha = new SHA256Managed())
{
byte[] encryptedBytes = sha.TransformFinalBlock(data, 0, data.Length);
return Convert.ToBase64String(sha.Hash);
}} #endregion protected void btnSubmit\_Click(object sender, EventArgs e) { bo.UserID = txtUserId.Text; Password p = new Password(txtPassword.Text.ToString()); String newpwd = p.SaltedPassword; System.Nullable<int> newsaltkey = p.Salt; bo.Encryptpwd = newpwd; bo.Saltkey = p.Salt; bo.Password = txtPassword.Text; passwordFormat = MembershipPasswordFormat.Hashed; if (passwordFormat == MembershipPasswordFormat.Hashed) bo.Blogpwd = HashPassword(txtPassword.Text); else bo.Blogpwd = txtPassword.Text;
Hi, You have asked this question so many times............:mad: Answer is same HASH IS ONE WAY ENCRYPTION
himanshu
-
Hash Algorithm are one way encryption.You can not decrypt what you can do,you can encrypt the text and then match with the encrypted one.If you require to decrypt the data then you can use other algorithms...
Cheers!! Brij Check My Latest Article
-
Hi, You have asked this question so many times............:mad: Answer is same HASH IS ONE WAY ENCRYPTION
himanshu
-
I havn't ask some many times.This is second time.First time i didnt get the expected answer.Thats y i post the same message again.Got it..
-
Try this for Encrypt and Decrypt Encrypt and Decrypt Data with C#[^]
Regards, Karthik K...