10. 使用python对Linux中文件的MD5校验(hashlib模块)
使用python对Linux中文件的MD5校验
In [1]: import hashlib
In [2]: d = hashlib.md5()
In [5]: with open('/etc/passwd','rb') as f:
...: for line in f:
...: d.update(line)
...:
In [6]: d.hexdigest()
Out[6]: '39fdaa1c981322413568d0d4eac78bb5'
浙公网安备 33010602011771号