Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

symfony/password-hasher v6.4.3

Provides password hashing utilities
Package summary
Share
0
issues
0
licenses
Package created
14 Feb 2021
Version published
23 Jan 2024
Maintainers
1
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does symfony/password-hasher do?

The Symfony/Password-Hasher is a PHP package that is typically used in securing applications. It provides password hashing utilities, granting developers an extra layer of security in their applications. This package allows for the creation and verification of secure hashes of plain passwords, making it an excellent tool to employ in the safeguarding of user data.

How do you use symfony/password-hasher?

To use the Symfony/Password-Hasher, make sure you have composer installed. You can then pull in the package by running $ composer require symfony/password-hasher. Here's a simple usage example:

use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;

// Configure different password hashers via the factory
$factory = new PasswordHasherFactory([
    'common' => ['algorithm' => 'bcrypt'],
    'memory-hard' => ['algorithm' => 'sodium'],
]);

// Retrieve the right password hasher by its name
$passwordHasher = $factory->getPasswordHasher('common');

// Hash a plain password
$hash = $passwordHasher->hash('plain'); // returns a bcrypt hash

// Verify that a given plain password matches the hash
$passwordHasher->verify($hash, 'wrong'); // returns false
$passwordHasher->verify($hash, 'plain'); // returns true (valid)

This script first creates a new instance of the PasswordHasherFactory. After, it configures bcrypt for general use and sodium for memory-hard tasks. Then, it retrieves a hasher and uses it to hash and verify a password.

Where are the symfony/password-hasher docs?

To gain a deeper understanding about the Symfony/Password-Hasher package, the documentation is your best resource. You can access it via the following link: Symfony/Password-Hasher Documentation. This contains comprehensive information on how to use and configure the password hasher to meet your specific needs.