对文件求md5值
import hashlib
def md5_file(f):
m = hashlib.md5()
with open(f, 'rb') as fd:
while True:
d = fd.read(8192) # 一次读取8k
if not d:
break
m.update(d)
return m.hexdigest()