Python &引用;“哈希校验和”;对象支持所需的缓冲区API
我试图计算pycharm中“Disk image”USbImg.E01的散列值Python &引用;“哈希校验和”;对象支持所需的缓冲区API,python,python-3.x,Python,Python 3.x,我试图计算pycharm中“Disk image”USbImg.E01的散列值 import hashlib try: file = open("F:/USB Try MATCH/USBTRY.E01",'r') except: print("\nFile not found") ad5 = hashlib.md5() ad5.update(file) print("md5: %s" % ad5.hexdigest()) 对象支持所需的缓冲区API 请尝试ad5.update
import hashlib
try:
file = open("F:/USB Try MATCH/USBTRY.E01",'r')
except:
print("\nFile not found")
ad5 = hashlib.md5()
ad5.update(file)
print("md5: %s" % ad5.hexdigest())
对象支持所需的缓冲区API
请尝试
ad5.update(file.read())
请在回答中添加解释
import hashlib
fiename = 'F:/NEWIMG2/ABC.E01'
hashermd5 = hashlib.md5()
with open(fiename,'rb') as open_file:
content = open_file.read()
hashermd5.update(content)
print("md5: %s" % hashermd5.hexdigest())