Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

hashing
php
laravel
communitycreator

Basics of hashing in Laravel

Chinweuba Elijah Azubuike

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring