用PHP加密数据 [英] Encrypt Data in PHP

查看:80
本文介绍了用PHP加密数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在网站上开发登录模块.
我有一件事想问大家.我想加密密码以保存到数据库.那么当用户忘记密码以发送密码时,我想解密它.我不谈论php中的MD5.
如果有人对此有经验,请与他人分享以开发世界上的人力资源.thank

I am developing login module in my website.
I have one thing to ask you all. I would like to encrypt password to save to database. then I want to decrypt it when user forgot their password in order to sent them his password.I do not talk about MD5 in php.
if someone has experience about this let share it for developing human resource in the world.thank

推荐答案

制作可逆散列的密码是非常不安全的.但是,如果必须,您可以使用简单的字符替换或base64编码和解码来进行自己的哈希处理.当然,您也可以将密码以其原始形式存储而无需加密",因为这些方法很容易被黑客入侵,甚至任何进入您数据库的人都将知道如何将其撤消.

我的建议是,以可接受的方式对它们进行哈希处理,如果他们忘记了,就让他们放弃将其随机重置为某种东西,然后他们可以在自己的时间更改它.
Its pretty insecure to make a reversibly-hashed password. But if you must you can either make your own hash using a simple character replacement or base64 encode and decode. Of course, you might as well store the password in its original form with no ''encryption'' since these methods are easily hacked and anyone who even finds their way into your db will know how to reverse them.

My suggestion, hash them by acceptable means and if they forget it, make them forgo having it reset to something randomly then they can change it on their own time.


这篇关于用PHP加密数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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