(声明:魏滔序原创,转贴请注明出处。)
我的组件之MD5Lib.dll(MD5编码效率奇高),可以引用ActiveX DLL的方法使用,也可以以动态连接库的形式使用。
下载地址:http://www.chenoe.com/developer/library/md5lib.dll
'示例代码:
Option Explicit
Private Enum MD5BitConstants
MD5_16Bit = 0
MD5_32Bit = 1
End Enum
Private Declare Sub MD5EncodeFromByte Lib "MD5Lib" (ByRef OutMD5() As Byte, ByRef Source() As Byte, ByVal MD5Bit As MD5BitConstants)
Private Declare Sub MD5EncodeFromFile Lib "MD5Lib" (ByRef OutMD5() As Byte, ByRef FileName() As Byte, ByVal MD5Bit As MD5BitConstants)
Private Sub Command1_Click()
Dim a() As Byte
Dim b() As Byte
a = StrConv("C:/Library/MD5Lib/MD5Lib.dll", vbFromUnicode)
MD5EncodeFromFile b, a, MD5_32Bit
MsgBox StrConv(b, vbUnicode)
End Sub
Private Sub Command2_Click()
Dim a() As Byte
Dim b() As Byte
a = StrConv("热爱祖国,热爱人民。", vbFromUnicode)
MD5EncodeFromByte b, a, MD5_32Bit
MsgBox StrConv(b, vbUnicode)
End Sub
Private Sub Command3_Click()
Dim a() As Byte
Dim b() As Byte
Dim MD5 As New MD5Lib.MD5Encode
a = StrConv("C:/Library/MD5Lib/MD5Lib.dll", vbFromUnicode)
MD5.EncodeFromFile b, a, MD5_32Bit
MsgBox StrConv(b, vbUnicode)
End Sub
Private Sub Command4_Click()
Dim a() As Byte
Dim b() As Byte
Dim MD5 As New MD5Lib.MD5Encode
a = StrConv("热爱祖国,热爱人民。", vbFromUnicode)
MD5.EncodeFromByte b, a, MD5_32Bit
MsgBox StrConv(b, vbUnicode)
End Sub