欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

用VBS实现PHP的md5_file函数代码

程序员文章站 2022-04-29 09:17:26
复制代码 代码如下: function md5_file(filename, raw_output) dim hasheddata, utility, stream set...
复制代码 代码如下:

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