|
Thread: Md5
-
Mar 29th, 2002, 08:09 AM
#1
Thread Starter
Addicted Member
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?
-
Mar 29th, 2002, 03:56 PM
#2
there is a class called
MD5CryptoServiceProvider
not sure what namespace it is in though..probably something like System.Cryptosomething....
do some searching for that.
-
Mar 29th, 2002, 04:13 PM
#3
Thread Starter
Addicted Member
-
Mar 29th, 2002, 04:22 PM
#4
Thread Starter
Addicted Member
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...
-
Apr 1st, 2002, 11:20 AM
#5
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.
-
Apr 2nd, 2002, 06:24 PM
#6
Thread Starter
Addicted Member
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 :-(
-
Apr 2nd, 2002, 06:34 PM
#7
VB Code:
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.
-
Apr 2nd, 2002, 07:37 PM
#8
Thread Starter
Addicted Member
-
Apr 2nd, 2002, 08:23 PM
#9
Thread Starter
Addicted Member
YAH! it works now, thanks for ur help mate!
-
Apr 2nd, 2002, 08:24 PM
#10
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|