MySQL和Python:在密码的前两个字符之后加盐
我在MySQL和Python工作。我有一个存储用户登录信息并希望使此安全的表格。在密码的前两个字符之后,如何添加盐?然后,我要使用SHA256进行哈希。
该表看起来像这样:
用户名 | 密码 | 盐 |
---|---|---|
测试 | testing123 | ABC09 |
我使用这样的表格制作了表,如果您可以在这里实现某些东西,我很乐意重做它。
CREATE TABLE `user` (
`username` varchar(20) NOT NULL,
`password` varchar(100) NOT NULL,
`salt` varchar(100) DEFAULT NULL
);
稍后,我将使用Python不使用并检索密码。
I am working in MYSQL and Python. I have a table that stores users login information and want to make this secure. How do I add the salt after the first two characters of the password? I am then going to hash it using sha256.
The table looks like this:
username | password | salt |
---|---|---|
test | testing123 | abc09 |
I made the table using like this, bit if there is something you can implement here I am happy to redo it.
CREATE TABLE `user` (
`username` varchar(20) NOT NULL,
`password` varchar(100) NOT NULL,
`salt` varchar(100) DEFAULT NULL
);
Later I am going to use python to unhash and retrieve the password.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现通过Python进行此操作更容易。我使用密码并使用Hashlib插入盐。
I found out that it is easier to do this thru python. I hash the password and insert the salt using hashlib.