2

I am setting up a system that migrates users from an external source and have determined the most time expensive part is when the UsersService _setPasswordOnUserRecord method hashes the password

$hash = craft()->security->hashPassword($user->newPassword);

This is taking about 2 secs where the rest of the operation for saving a user is about .2 sec. There are close to 10k users to it's really adding up! Is there any way to use a faster type of hash or bypass the hashing, or am I out of luck?

example:

    $user = new UserModel;

    $user->firstName    = "First";
    $user->lastName     = 'last';
    $user->newPassword  = '123456';
    $user->email        = 'email@email.com';
    $user->username     = 'username';




    $wasSaved = craft()->users->saveUser($user);
2

There is a general config setting for this:

https://craftcms.com/docs/config-settings#blowfishHashCost

Setting this to the minimum value:

'blowfishHashCost' => 4

made the hashing time negligible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.