我想使用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