Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

hashing
php
laravel
communitycreator

Basics of hashing in Laravel

Chinweuba Elijah Azubuike
widget

The Laravel Hash facade gives secure Bcrypt and Argon2 hashing to save client passwords. If you utilize one of the Laravel application starter packs, Bcrypt will be utilized for enlistment and authentication by default.

Bcrypt is a good choice for hashing passwords since its “work figure” is movable. This implies that the time it takes to generate a hash can be expanded with increased hardware power.

When hashing passwords, moderation is better. The longer an algorithm takes to hash a secret word, the longer it takes users to produce “rainbow tables” of all the conceivable hash values. These hash values will be used against applications.

How to perform basic hashing

  • To perform basic hashing in Laravel, we call the make() method on the Hash facade, like so:
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;

  • Once you ensure that the necessary classes above are present, you then make your hash using the make() method on the hash facade, like so:

  • $hashPassword = Hash::make($request->('password'));

  • You then save the $hashPassword using whatever method you like in the database.

RELATED TAGS

hashing
php
laravel
communitycreator

CONTRIBUTOR

Chinweuba Elijah Azubuike
RELATED COURSES

View all Courses

Keep Exploring