Link to home
Start Free TrialLog in
Avatar of wrenfro
wrenfro

asked on

VB.net Function to match ColdFusion hash function

I am looking for some VB.net code to match the ColdFusion Function hash().

I am working on a Web/Client application that is caching some security on the client and needs to work in a disconnected environment using vb.net.  the passwords have been saved after using the hash function.  

here is a sample if the vb code I have tried but the result does not match  the result from hash("test")
 
Dim md5Hasher As New MD5CryptoServiceProvider
Dim hashedBytes As Byte()
Dim encoder As New UTF8Encoding
hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes("test"))
        Dim hashString As String
        hashString = Convert.ToBase64String(hashedBytes)

any ideas?
Avatar of wrenfro
wrenfro

ASKER

The ColdFusion page returns the hash as a hex representation

the following code will do the same in VB.NET

Dim PWordbyte As Byte

        For Each PWordbyte In hashedBytes
            hashString = hashString & String.Format("{0:X2}", PWordbyte)
        Next
ASKER CERTIFIED SOLUTION
Avatar of mrichmon
mrichmon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial