Problem generating MD5 hash from asp classic like .NET

Discussion in 'ASP General' started by Bshowers, Nov 12, 2004.

  1. Bshowers

    Bshowers Guest

    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
     
    Bshowers, Nov 12, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MartyNg
    Replies:
    2
    Views:
    3,866
    Klaus H. Probst
    Apr 8, 2006
  2. Replies:
    9
    Views:
    17,107
    John Salerno
    May 8, 2006
  3. Derrick
    Replies:
    0
    Views:
    200
    Derrick
    Aug 23, 2004
  4. rp
    Replies:
    1
    Views:
    539
    red floyd
    Nov 10, 2011
  5. Peter Woodsky

    create a md5 / md5 passwd with a salt

    Peter Woodsky, Nov 20, 2008, in forum: Ruby
    Replies:
    6
    Views:
    219
    Brian Candler
    Nov 21, 2008
Loading...

Share This Page