What is the hash generation algorithm that Laravel uses?

4

By default Laravel already comes with a pre-ready authentication system, however, someone would know to tell me what the default algorithm this framework uses for hash and what version thereof?

    
asked by anonymous 01.03.2017 / 14:04

1 answer

7

According to documentation , for this type of task, BCrypt , which matches a ask about secure passwords here . 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 placed it on GitHub for future reference .

    
01.03.2017 / 14:15