79794145

Date: 2025-10-19 07:39:56
Score: 1.5
Natty:
Report link
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;

function hashPassword($plainText)
{
    $passwordHasherFactory = new PasswordHasherFactory(['common' => ['algorithm' => 'bcrypt']]);
    $hasher = $passwordHasherFactory->getPasswordHasher('common');
    return $hasher->hash($plainText);
}

Full example: https://symfony.com/doc/current/security/passwords.html#hashing-a-stand-alone-string

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: David Petrásek