hashing

rbharris

Member
Joined
May 26, 2006
Messages
14
Programming Experience
Beginner
I found this code that hashes a string:

VB.NET:
Public Function GenerateHash(ByVal SourceText As String) As String
'Create an encoding object to ensure the encoding standard for the source text
Dim Ue As New UnicodeEncoding()
'Retrieve a byte array based on the source text
Dim ByteSourceText() As Byte = Ue.GetBytes(SourceText)
'Instantiate an MD5 Provider object
Dim Md5 As New MD5CryptoServiceProvider()
'Compute the hash value from the source
Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)
'And convert it to String format for return
Return Convert.ToBase64String(ByteHash)
End Function

It obviously works fine. Can you reverse this? In other words if a string is passed through this function and therefored hashed, can the hashed version be reversed back to the original string?
 
The answer to your question is Nope.... that's the point of hashing... it's designed to be one way.

-tg
 
Back
Top