Take a look at the make
method.
You can pass an options array as the second parameter, where you can define the cost value.
Hash::make('stringtobehashed', array('cost' => 20));
Question
Is there any way to use Laravel's Auth and Hash, but change the bcrypt cost?
The default is defined here http://laravel.com/api/source-class-Illuminate.Hashing.BcryptHasher.html
Solution
Take a look at the make
method.
You can pass an options array as the second parameter, where you can define the cost value.
Hash::make('stringtobehashed', array('cost' => 20));
OTHER TIPS
I know this thread is very old, but just for quick reference,
If you're using Laravel 4.0 and up, change cost
to rounds
. You can look at the code here.
EDIT:
Alternatively and as of Laravel 4.2, you can set the rounds
once and for all, in some ServiceProvider's boot
method (probably in the AppServiceProvider
), using:
Hash::setRounds(12);