更好的方法在mysql中保存密码,也可以使用php进行解密 [英] Better way save password in mysql which can be decrypted also using php
问题描述
现在我的用户想要忘记密码,应该得到相同的(旧)密码,而不是新的密码。
所以我的问题是我应该用什么来加密我的密码并存储在mysql数据库中。
我也可以解密密码。
我正在运行php和mysql。
谢谢
Avinash
不要这样做
首先,使用比md5更好的东西。然后创建一个重置密码的方法,但绝对不能从数据库中实际检索密码...
这将使您的应用程序更不安全,但可能更糟糕如果您的数据被盗,您和您的用户将遇到问题!有人会拥有一个数据库,其中包含所有用户的用户名和密码!
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.
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.
i am running on php and mysql.
Thanks
Avinash
Don't do that...
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进行解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!