What is the hash generation algorithm that Laravel uses?

Asked

Viewed 423 times

5

By default Laravel already comes with a pre-ready authentication system, however, someone would know tell me what the algorithm is default that this framework use for generation of hash and what version?

1 answer

8


According to the documentation, for this type of task, the Bcrypt, what goes against a question here about safe passwords. Example:

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use App\Http\Controllers\Controller;
class UpdatePasswordController extends Controller {
    /**
     * Update the password for the user.
     *
     * @param  Request  $request
     * @return Response
     */
    public function update(Request $request) {
        // Validate the new password length...
        $request->user()->fill([
            'password' => Hash::make($request->newPassword)
        ])->save();
    }
}

I put in the Github for future reference.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.