常用模块2
hashalib模块
import hashlib
md5_obj=hashlib.md5()
import os
filesize=os.path.getsize('filename')
f=open('filename','rb')
while filesize>0:
if filesize>1024:
content =f.read(1024)
filesize-=1024
else:
content=f.read(filesize)
filseize-=filesize
md5_obj.update(content)
#for line in f:
#md5_obj.update(line.encode('utf-8'))
md5_obj.hexdigest()
# 文件效验
#文件是否被改变
#登录密码
#不能解密,但是可以撞库
#加盐 hashlib.md5('nezha'.encode('utf-8'))