加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 在Lithium会话中存储密码是否安全?

发布时间:2020-12-13 17:43:53 所属栏目:PHP教程 来源:网络整理
导读:我想使用Lithium的“cookie”会话适配器.用户登录后,我将使用他的哈希密码创建一个cookie.如果此cookie存在且散列密码与db中的密码匹配,我将自动登录. 这样安全吗? 好吧,我不是在讨论cookie中的实际哈希,而是加密哈希.我不希望任何人知道该哈希看起来如何:)
我想使用Lithium的“cookie”会话适配器.用户登录后,我将使用他的哈希密码创建一个cookie.如果此cookie存在且散列密码与db中的密码匹配,我将自动登录.

这样安全吗?

好吧,我不是在讨论cookie中的实际哈希,而是加密哈希.我不希望任何人知道该哈希看起来如何:)
Lithium具有“策略”,可以加密您在会话中存储的具有“秘密”的任何数据,因此哈希将被加密.基本上我在问锂的加密是否足够好.有人和Lithium合作过吗?

解决方法

这取决于你的散列算法.使用salt可以使哈希更安全: Safe Password Hashing

Remember,the hash of the password is effectively the same as their
password. Somebody who stole the hash would have the same access to
the user’s account as if they had stolen their password. Therefore it
is not advisable to store a hash of the user’s password in a cookie
unless there was some other information not stored with the cookie
that is used to authenticate (i.e. 2-factor authentication). 07001 in this 07002.

还可以查看这些链接:
Is it advisable to store a hashed password in a cookie?
Secure hash and salt for PHP passwords

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读