获取字符串MD5
import hashlib md5=hashlib.md5("Your String".encode('utf-8')).hexdigest()
m = hashlib.md5() m.update("Your string") md5 = m.hexdigest()
获取文件MD5
import hashlib def getAPKMD5(apk_filename): md5file = open(apk_filename, "rb") md5_file = hashlib.md5(md5file.read()).hexdigest() md5file.close() return md5_file