hashlib对密码进行加密

1.导入hashlib库

import hashlib

2.对密码进行加密

newUser = User() #这里的User是我们导入的model
m=hashlib.md5()
m.update(dictData['password'].encode('utf-8')) #dictData是前端传过来的form
newUser.password = m.hexdigest()
原文地址:https://www.cnblogs.com/daicw/p/12058504.html