mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
- Add Symfony Form Component - Add Symfony CSRF security component - Add iTop default form template - Add Twig debug extension to Twig Environment - Add iTop abstract controller facility to get form builder - Add Twig filter to make trans an alias of dict_s filter
41 lines
1.2 KiB
Markdown
41 lines
1.2 KiB
Markdown
PasswordHasher Component
|
|
========================
|
|
|
|
The PasswordHasher component provides secure password hashing utilities.
|
|
|
|
Getting Started
|
|
---------------
|
|
|
|
```
|
|
$ 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)
|