Laravel 5 – SHA1 encryption instead of BCrypt

Recently I have migrated core PHP application to the Laravel5 framework. The old application used SHA1 encryption so I have implemented Hashing contracts of laravel5 to use SHA1 instead of BCrypt.

SHA1 encryption instead of BCrypt

Create Directories in app called “Libraries\ShaHash” and create a file called SHAHasher.php and place below code in it.

Then create a service provider class(App\Providers) file called ShaHashServiceProvider.php and register your service as shown below.

Then add our new service provider to providers array in config/app.php. and also remove default hash provider.

That is it.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mateo Quintero
Mateo Quintero
2 years ago

Y como se utiliza en un controlador

Hamza
Hamza
14 days ago

Hello, i have laravel 5.8 et i followed all the instructions you have mentionned above , but i got this error :

Class App\Libraries\ShaHash\SHAHasher contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Illuminate\Contracts\Hashing\Hasher::info)

Thanks for your help..

DMCA.com Protection Status
2
0
Would love your thoughts, please comment.x
()
x