MD5 加密算法 VB 实现代码
虽然现在MD5 加密算法严格来讲已经不算安全,但一般小功能或公司内部使用应该足够了
Attribute VB_Name = "modMd5"
' MODULE: CMD5
'*******************************************************************************
Option Explicit
Public Const BITS_TO_A_BYTE As Long = 8
Public Const BYTES_TO_A_WORD As Long = 4
Public Const BITS_TO_A_WORD As Long = BYTES_TO_A_WORD * BITS_TO_A_BYTE
Public m_lOnBits(0 To 30) As Long
Public m_l2Power(0 To 30) As Long
Public Function MD5_Encrypt(ByVal sText As String) As String
MD5_Init
MD5_Encrypt = MD5(sText)
End Function
'*******************************************************************************
' Class_Initialize (SUB)
'
' DESCRIPTION:
' We will usually get quicker results by preparing arrays of bit patterns and
' powers of 2 ahead of time instead of calculating them every time, unless of
' course the methods are only ever getting called once per instantiation of the
' class.
'*******************************************************************************
Public Sub MD5_Init()
' Could have done this with a loop calculating each value, but simply
' assigning the values is quicker - BITS SET from RIGHT
m_lOnBits(0) = 1 ' 00000000000000000000000000000001
m_lOnBits(1) = 3 ' 00000000000000000000000000000011
m_lOnBits(2) = 7 ' 00000000000000000000000000000111
m_lOnBits(3) = 15 ' 00000000000000000000000000001111
m_lOnBits(4) = 31 ' 00000000000000000000000000011111
m_lOnBits(5) = 63 &nb
相关文档:
Option Explicit
Private Const INTERNET_OPEN_TYPE_DIRECT = 1
Private Const scuseragent = "vb wininet"
Private Const INTERNET_FLAG_PASSIVE = &H8000000
'调用设置环境
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long ......
VB中 Replace 函数
描述
返回字符串,其中指定数目的某子字符串被替换为另一个子字符串。
语法
Replace(expression, find, replacewith[, compare[, count[, start]]])
Replace 函数的语法有以下参数:
参数 描述
expression 必选。字符串表达式,包含要替换的子字符串。
find 必选。被搜索的子字符串。
......
通过调用CreateDataSetfromXml取得XML数据
Imports System.Xml
Public Const FILE_CONFIG = "MZZ.xml"
Public Const PATH_CONFIG = "\XML\"
Dim dstXML As DataSet
Dim tblXML_DB As DataTable
Dim dtCod As New DataTable
Dim strSQL As String = ""
clsPublic ......
使用c#语言在.net平台生成的dll是基于MSIL的二进制代码,通常情况下是无法被native的语言和程序调用的(例如vb,vc,delphi)。但是一般来说windows上native的程序都是可以直接使用com对象的。通过.net平台提供的一些工具,可以为其伪造一个com接口并注册到系统中。此时,可以在native的程序里,通过这个伪com接口来实现此. ......