想安全地存储用户密码
Python27
Linux-Server
其实只要保证处理之后的字符不发生碰撞就好,你只需要存储比对计算后的结果,只要最终字符一致就是密码一致。比如QQ的双MD5。
最好的方法当然是永远不要decrypt
喽
你看下这里的例子:
https://paragonie.com/blog/20...
import bcrypt import hmac # Calculating a hash password = b"correct horse battery staple" hashed = bcrypt.hashpw(password, bcrypt.gensalt()) # Validating a hash (don't use ==) if (hmac.compare_digest(bcrypt.hashpw(password, hashed), hashed)): # Login successful
用bcrypt
妥妥的