New in Symfony 4.3: Sodium password encoder
In Symfony 3.4 we added an Argon2i password hasher as a modern replacement of the Bcrypt hasher. Argon2i support is provided through the libsodium library, which selects the Argon2 variant (argon2d, argon2i or argon2id) automatically based on the host system.
Given that the Argon2 variant selection is out of Symfony's control, in Symfony
4.3 we've decided to not add an
Argon2idPasswordEncoder, to deprecate the
Argon2iPasswordEncoder class and to add instead a generic
This new encoder relies on libsodium to select the best possible Argon2 variant. In practice, the only change you'll need to make in most of your applications is to update the name of the hashing algorithm in the main security config file:
1 2 3 4 5 6 7
# config/packages/security.yaml security: # ... encoders: App\Entity\User: - algorithm: argon2i + algorithm: sodium
The name of the Argon2 variant used to hash the password is included in the hash itself, so you can update this config option safely. If a new variant is picked by libsodium, all your existing passwords will keep working.
Besides, all the existing Argon2i configuration options are still available
under the new
sodium algorithm name.
New in Symfony 4.3: Sodium password encoder symfony.com/blog/new-in-symfony-4-3-sodium-password-encoderTweet this
Become a certified developer! Exams are online and available in all countries.Register Now
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.