Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/symfony/password-hasher
Provides password hashing utilities
https://github.com/symfony/password-hasher
component hashing password php symfony symfony-component
Last synced: 7 days ago
JSON representation
Provides password hashing utilities
- Host: GitHub
- URL: https://github.com/symfony/password-hasher
- Owner: symfony
- License: mit
- Created: 2021-02-14T10:27:31.000Z (almost 4 years ago)
- Default Branch: 7.2
- Last Pushed: 2024-11-29T09:07:04.000Z (about 2 months ago)
- Last Synced: 2025-01-04T12:03:18.433Z (17 days ago)
- Topics: component, hashing, password, php, symfony, symfony-component
- Language: PHP
- Homepage: https://symfony.com/password-hasher
- Size: 176 KB
- Stars: 752
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
PasswordHasher Component
========================The PasswordHasher component provides secure password hashing utilities.
Getting Started
---------------```bash
composer require symfony/password-hasher
``````php
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
---------* [Documentation](https://symfony.com/doc/current/security.html#c-hashing-passwords)
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
* [Report issues](https://github.com/symfony/symfony/issues) and
[send Pull Requests](https://github.com/symfony/symfony/pulls)
in the [main Symfony repository](https://github.com/symfony/symfony)