用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

赞赏

微信赞赏支付宝赞赏

随机文章:

  1. VBS调用IE对象直接打印网页
  2. VBS和UAC用户帐户控制
  3. VBS转EXE工具:Exe From Vbs
  4. 用VBS解析JSON格式数据之VbsJson类
  5. COMRaider

一条评论 发表在“用VBS实现PHP的md5_file函数”上

  1. […] 曾经写过一篇《用VBS实现PHP的md5_file函数》,里面给出的 md5_file 函数可以用来计算文件的 MD5 hash 值。 […]

利用 WindowsInstaller.Installer 对象计算文件 MD5 hash 值 | Demon's Blog 留下回复