GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  ASP.NET
Go To First  |  Previous Question  |  Next Question 
 ASP.NET  |  Question 46 of 164    Print  
How can i decrypt a password that had already encrypted using MD5 format in ASP.NET?
or
How can I compare password that entered by a user with the encrypted password ( encryption had done using MD5 format) ?

  
Total Answers and Comments: 7 Last Update: June 22, 2006     Asked by: vijayan_kiran 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 23, 2006 06:38:40   #1  
Manoj Shekhawat        

RE: How can i decrypt a password that had already encr...
hi....U can decrypt it by same MD5 class which is used to encrypt it as in .net library have the support for both.
 
Is this answer useful? Yes | No
April 30, 2006 04:28:14   #2  
sourav        

RE: How can i decrypt a password that had already encr...

hi

1. Use System.Security.Cryptography namespace.

2. Decalre an object of MD5CryptoServiceProvider and compute hash keys for the variable.


 
Is this answer useful? Yes | No
April 30, 2006 04:31:03   #3  
sourav        

RE: How can i decrypt a password that had already encr...

1. Use namespace System.Security.Cryptography.

2. declare an UTF8Encoding object.

3. declare an object of MD5CryptoServiceProvider compute hash keys and compute the hash key for the variable.

Hope this will suffice ur need.


 
Is this answer useful? Yes | No
May 09, 2006 03:25:50   #4  
kiran        

RE: How can i decrypt a password that had already encr...
once password is encrypted by using md5 format there is no chance to decrypting it. if we want to check for password store the encrypted password in the database then when comparing encrypt the password from the textfield and then compare.
 
Is this answer useful? Yes | No
May 11, 2006 10:37:18   #5  
Anand        

RE: How can i decrypt a password that had already encr...

u cannot decrypt a password from a string encrypted by MD5 as it takes a long time may be years

the best way to do is convert the password in MD5 and then compare both by converting both in Base64String


 
Is this answer useful? Yes | No
May 11, 2006 23:48:18   #6  
vijayan_kiran Member Since: April 2006   Contribution: 4    

RE: How can i decrypt a password that had already encr...

Thank for your comments


 
Is this answer useful? Yes | No
June 22, 2006 08:50:31   #7  
chetan.pawar        

RE: How can i decrypt a password that had already encr...

Try This function.......for both Decrypt and Encrypt also....

Public Function psDecrypt(ByVal sQueryString As String) As String

Dim buffer() As Byte
Dim loCryptoClass As New TripleDESCryptoServiceProvider
Dim loCryptoProvider As New MD5CryptoServiceProvider

Try

buffer Convert.FromBase64String(sQueryString)
loCryptoClass.Key loCryptoProvider.ComputeHash(ASCIIEncoding.ASCII.GetBytes(lscryptoKey))
loCryptoClass.IV lbtVector
Return Encoding.ASCII.GetString(loCryptoClass.CreateDecryptor().TransformFinalBlock(buffer 0 buffer.Length()))
Catch ex As Exception
Throw ex
Finally
loCryptoClass.Clear()
loCryptoProvider.Clear()
loCryptoClass Nothing
loCryptoProvider Nothing
End Try

End Function
Public Function psEncrypt(ByVal sInputVal As String) As String
Dim loCryptoClass As New TripleDESCryptoServiceProvider
Dim loCryptoProvider As New MD5CryptoServiceProvider
Dim lbtBuffer() As Byte

Try
lbtBuffer System.Text.Encoding.ASCII.GetBytes(sInputVal)
loCryptoClass.Key loCryptoProvider.ComputeHash(ASCIIEncoding.ASCII.GetBytes(lscryptoKey))
loCryptoClass.IV lbtVector
sInputVal Convert.ToBase64String(loCryptoClass.CreateEncryptor().TransformFinalBlock(lbtBuffer 0 lbtBuffer.Length()))
psEncrypt sInputVal
Catch ex As CryptographicException
Throw ex
Catch ex As FormatException
Throw ex
Catch ex As Exception
Throw ex
Finally
loCryptoClass.Clear()
loCryptoProvider.Clear()
loCryptoClass Nothing
loCryptoProvider Nothing
End Try
End Function


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape