Cakephp 2.0 default hash type

The default hash type of Cakephp 2.0 is sha1. But when you have set a Security.Salt in the core.php this will be added before your password and before the encryption is done.

To generate a password with Salt you can either create an User::add method in Cakephp and use the Authcomponent or create some your own. I needed it for fast checking user accounts with a javascript frontend (no views are used).

// Your salt from core.php
// Configure::write('Security.salt', 'e4ac429040b9d4552bc425b677b64aca104c5f84f');
$salt = 'e4ac429040b9d4552bc425b677b64aca104c5f84f';
$yourpassword = 'mysecret';
 
$password = sha1($salt.$yourpassword);
// The password to use in Cakephp with the Authcomponent
print $password;

Thats all, you use that password in your mysql admin tool to create users on the fly.

Source

Pin It on Pinterest