用VBS实现PHP的md5_file函数代码
Function md5_file(filename, raw_output)
Dim HashedData, Utility, Stream
Set HashedData = CreateObject("CAPICOM.HashedData")
Set Utility = CreateObject("CAPICOM.Utilities")
Set Stream = CreateObject("ADODB.Stream")
HashedData.Algorithm = 3
Stream.Type = 1
Stream.Open
Stream.LoadFromFile filename
Do Until Stream.EOS
HashedData.Hash Stream.Read(1024)
Loop
If raw_output Then
md5_file = Utility.HexToBinary(HashedData.Value)
Else
md5_file = HashedData.Value
End If
End Function
参考链接:HashedData Object
原文:http://demon.tw/programming/vbs-php-md5_file.html
用VBS模拟实现PHP的sha1_file函数效果代码
Functionsha1_file(filename,raw_output)DimHashedData,Utility,StreamSetHashedData=CreateObject("CAPICOM.HashedData")SetUtility=CreateObject("CAPICOM.Utilities")SetStream=CreateObject("ADODB.Stream")Hash
VBS中通过调用CAPICOM对象实现SHA1&MD5加密
本来打算自己写的,但是看到复杂的算法描述就知难而退了。算了吧,有现成的COM对象调用,又何必去关心算法呢,直接拿来使用就行了。如果下面的
用VBS获取Unix时间戳的函数代码
VBS中没有类似C标准库中的time函数,怎么获取Unix时间戳呢?乍一看很简单:FunctionUnixTime()UnixTime=DateDiff("s","01/01/197000:00:00",Now())EndFunction一个很想当然的
编辑:广州明生医药有限公司
标签:函数,算法,对象,代码,时间