Better way save password in mysql which can be decrypted also using php(更好的方法将密码保存在mysql中,也可以使用php解密)
问题描述
我目前正在使用md5函数加密我的密码并保存到无法解密的mysql数据库中.
I am currently using md5 function to encrypt my password and save to mysql db which can not be decrypted.
现在我的用户希望当他们忘记密码时,他们应该得到相同的(旧)密码而不是新密码.
Now my user want that when they forgot password, they should get same (old) password instead of new password.
所以我的问题是我应该使用什么来加密我的密码并存储在 mysql 数据库中.我也可以解密那个密码.
So my question is that what should i use to encrypt my password and store in mysql Database. And i can decrypt that password also.
我在 php 和 mysql 上运行.
i am running on php and mysql.
谢谢
阿维纳什
推荐答案
不要那样做...
首先,使用比 md5 更好的东西.然后创建一种重置"密码的方法,但绝不是从数据库中实际检索密码的方法......
First, use something better than md5. Then create a way to "reset" the password, but never a way to actually retreive the password from the db...
这会降低您的应用程序的安全性,但可能会更糟;如果您的数据被盗,您和您的用户都会遇到问题!有人将拥有一个包含您所有用户的用户名和密码的数据库!
That will make your app less secure, but maybe even worse; you and your users will have a problem if your data gets stolen! Someone is going to have a database with usernames and passwords of all your users!
这篇关于更好的方法将密码保存在mysql中,也可以使用php解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:更好的方法将密码保存在mysql中,也可以使用php解密
基础教程推荐
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何替换eregi() 2022-01-01
