auth.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:web 作者: pyjobs 项目源码 文件源码
def _hash_password(cls, password):
        salt = sha256()
        salt.update(os.urandom(60))
        salt = salt.hexdigest()

        hash = sha256()
        # Make sure password is a str because we cannot hash unicode objects
        hash.update((password + salt).encode('utf-8'))
        hash = hash.hexdigest()

        password = salt + hash

        # Make sure the hashed password is a unicode object at the end of the
        # process because SQLAlchemy _wants_ unicode objects for Unicode cols
        password = password.decode('utf-8')

        return password
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号