python自带的hashlib库可以处理md5 签名。
import hashlib
def md5sign(filename):
with open(filename, "rb") as f:
try:
fmd5 = hashlib.md5(f.read())
return fmd5.hexdigest() ##返回文件的签名
except Exception as e:
logger.info("error=%s", repr(e))
python自带的hashlib库可以处理md5 签名。
import hashlib
def md5sign(filename):
with open(filename, "rb") as f:
try:
fmd5 = hashlib.md5(f.read())
return fmd5.hexdigest() ##返回文件的签名
except Exception as e:
logger.info("error=%s", repr(e))
转载于:https://www.cnblogs.com/huanhuaqingfeng/p/11130588.html