要通过Python在SHA512哈希MySQL数据库中的密码 [英] To SHA512-hash a password in MySQL database by Python

查看:354
本文介绍了要通过Python在SHA512哈希MySQL数据库中的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题基于答案

我想知道如何通过SHA1哈希您的密码,然后通过Python删除MySQL数据库中的明文密码。

I would like to know how you can hash your password by SHA1 and then remove the clear-text password in a MySQL database by Python.

如何通过Python在MySQL数据库中哈希密码

推荐答案

由于文档说您应该使用 hashlib 库,而不是sha python 2.5。

As the documentation says you should use hashlib library not the sha since python 2.5.

这是很容易做一个哈希。

It is pretty easy to do make a hash.

hexhash = hashlib.sha512("some text").hexdigest()

易于存储在数据库中。

这篇关于要通过Python在SHA512哈希MySQL数据库中的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆