【发布时间】:2021-12-06 11:49:46
【问题描述】:
def hash(malware, hash):
h = hashlib.hash()
with open(malware,'rb') as f:
chunk = 0
while chunk != b'':
chunk = f.read(1024)
h.update(chunk)
return h.hexdigest()
hash(file, 'sha1')
hash(file, 'sha256')
我要做的是使用 hashlib 模块的属性“sha1”和“sha256”作为函数参数。
这是否可能,或者有办法做到这一点?
【问题讨论】: