webroot/vendor/symfony/password-hasher
2024-12-01 20:57:32 +01:00
..
Command 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
Exception 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
Hasher 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
CHANGELOG.md 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
composer.json 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
LegacyPasswordHasherInterface.php 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
LICENSE 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
PasswordHasherInterface.php 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00
README.md 2024.12.01 20:57:28 2024-12-01 20:57:32 +01:00

PasswordHasher Component

The PasswordHasher component provides secure password hashing utilities.

Getting Started

$ composer require symfony/password-hasher
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)

Resources