How can i decrypt a password that had already encrypted using MD5 format in ASP.NET?orHow can I compare password that entered by a user with the encrypted password ( encryption had done using MD5 format) ?

Questions by vijayan_kiran   answers by vijayan_kiran

Showing Answers 1 - 7 of 7 Answers

Manoj Shekhawat

  • Apr 23rd, 2006
 

hi....U can decrypt it by same MD5 class which is used to encrypt it as in .net library have the support for both.

  Was this answer useful?  Yes

sourav

  • Apr 30th, 2006
 

hi,

     1. Use System.Security.Cryptography namespace.

   

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

  Was this answer useful?  Yes

sourav

  • Apr 30th, 2006
 

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.

  Was this answer useful?  Yes

kiran

  • May 9th, 2006
 

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.

  Was this answer useful?  Yes

Anand

  • May 11th, 2006
 

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

  Was this answer useful?  Yes

chetan.pawar

  • Jun 22nd, 2006
 

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

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions