Problem generating MD5 hash from asp classic like .NET

B

Bshowers

I need to generate an MD5 hash in ASP, not ASP.NET, and have that hash be
the same as what is produced by the .NET MD5CryptoServiceProvider.
This is the vb.net code I am using...

Function GenerateMD5Hash(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
MsgBox(System.Text.ASCIIEncoding.ASCII.GetString(ByteHash))
Return Convert.ToBase64String(ByteHash)
End Function


Thanks in advance!

William Showers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top