📜  python 文件 hashlib - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:54.926000             🧑  作者: Mango

代码示例1
import hashlib
BLOCKSIZE = 65536
hasher = hashlib.md5()
with open('anotherfile.txt', 'rb') as afile:
    buf = afile.read(BLOCKSIZE)
    while len(buf) > 0:
        hasher.update(buf)
        buf = afile.read(BLOCKSIZE)
print(hasher.hexdigest())