Results 1 to 10 of 10

Thread: Md5

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176

    Md5

    In VB6 i had a nice DLL to make MD5 hashes but the module that was needed for that doesn't seem to work in .NET.

    Code:
    Private Declare Sub MDFile Lib "aamd532.dll" (ByVal f As String, ByVal r As String)
    Private Declare Sub MDStringFix Lib "aamd532.dll" (ByVal f As String, ByVal t As Long, ByVal r As String)
    
    Public Function MD5String(p As String) As String
    ' compute MD5 digest on a given string, returning the result
        Dim r As String * 32, t As Long
        r = Space(32)
        t = Len(p)
        MDStringFix p, t, r
        MD5String = r
    End Function
    
    Public Function MD5File(f As String) As String
    ' compute MD5 digest on o given file, returning the result
        Dim r As String * 32
        r = Space(32)
        MDFile f, r
        MD5File = r
    End Function
    Could someone help me with this?
    JpEgy

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    there is a class called
    MD5CryptoServiceProvider

    not sure what namespace it is in though..probably something like System.Cryptosomething....

    do some searching for that.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    oki :-)
    JpEgy

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    http://www.planetsourcecode.com/vb/s...d=74&lngWId=10

    i found a nice example on that page.

    Imports System.Security.Cryptography

    Now i still need to know how to make a hashtable of a textstring...
    JpEgy

  5. #5
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    If you replace all the "as Longs" with "as Int32" and remove the fixed strings, that code might work.
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    Private Declare Sub MDStringFix Lib "aamd532.dll" (ByVal f As String, ByVal t As Long, ByVal r As String)

    Public Function MD5String(ByVal p As String) As String
    ' compute MD5 digest on a given string, returning the result
    Dim r As String, t As Int32
    r = Space(32)
    t = Len(p)
    MDStringFix(p, t, r)
    MD5String = r
    End Function

    Like this?

    Refference not set to an instance of an object :-(
    JpEgy

  7. #7
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    VB Code:
    1. Private Declare Sub MDStringFix Lib "aamd532.dll" (ByVal f As String, ByVal t As [b]Int32[/b], ByVal r As String)
    You forgot one -- This is important, since in .NET, a Long is 8 bytes, whereas it was 4 in previous versions. This will cause a problem in declares, because you are passing 8 bytes where it expects 4.
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    oops
    JpEgy

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Dec 2001
    Location
    Guess....i have wooden shoes, in my free time i sell tulips and I live in a huge windmill...
    Posts
    176
    YAH! it works now, thanks for ur help mate!
    JpEgy

  10. #10
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    no problem -- i had the exact same trouble trying to port some of my code over.
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width