如何使用VBA获取文件的MD5十六进制哈希值? [英] How to get the MD5 hex hash for a file using VBA?

查看:737
本文介绍了如何使用VBA获取文件的MD5十六进制哈希值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要一个适用于文件的版本。



像这段Python代码一样简单:

  import hashlib 

def md5_for_file(fileLocation,block_size = 2 ** 20):
f = open(fileLocation)
md5 = hashlib.md5()
而True:
data = f.read(block_size )
如果不是数据:
break
md5.update(data)
f.close()
return md5.hexdigest()

但是在VBA中。

解决方案

http://www.di-mgt.com.au/crypto.html #MD5


How can I get the MD5 hex hash for a file using VBA?

I need a version that works for a file.

Something as simple as this Python code:

import hashlib

def md5_for_file(fileLocation, block_size=2**20):
    f = open(fileLocation)
    md5 = hashlib.md5()
    while True:
        data = f.read(block_size)
        if not data:
            break
        md5.update(data)
    f.close()
    return md5.hexdigest()

But in VBA.

解决方案

http://www.di-mgt.com.au/crypto.html#MD5

这篇关于如何使用VBA获取文件的MD5十六进制哈希值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆