On Dec 21, 2010, at 12:02, Ryan Schmidt wrote:
> On Dec 21, 2010, at 11:42, John Maxim wrote:
>>                  $this->data['User']['password'] = 
>> md5($this->data['User']['password']);
> 
> As I said in my previous message, use Security::hash(). Do not use md5(). If 
> you want Security::hash() to use the md5 algorithm internally, use 
> "Security::setHash('md5');" in your config file.
> 
> Security::hash() doesn't just call the requested hash function on the given 
> data; it also makes use of the salt specified in your config file. That's why 
> it doesn't match what you get when you just call md5() manually without the 
> salt.


I should add that Security::hash() does not use the salt unless you tell it to, 
by passing true in the third parameter. The Auth component does pass true in 
the third parameter, so if you want to write code today that will store 
passwords in the database that will be compatible with the Auth component when 
you switch to it later, you should hash with:

Security::hash($this->data['User']['password'], null, true)



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to