@@ -137,12 +137,12 @@ encoding algorithm. Also, each algorithm defines different config options:
137137 algorithm : ' bcrypt'
138138 cost : 15
139139
140- # Argon2i encoder with default options
141- App\Entity\User : ' argon2i '
140+ # Sodium encoder with default options
141+ App\Entity\User : ' sodium '
142142
143- # Argon2i encoder with custom options
143+ # Sodium encoder with custom options
144144 App\Entity\User :
145- algorithm : ' argon2i '
145+ algorithm : ' sodium '
146146 memory_cost : 16384 # Amount in KiB. (16384 = 16 MiB)
147147 time_cost : 2 # Number of iterations
148148 threads : 4 # Number of parallel threads
@@ -175,19 +175,19 @@ encoding algorithm. Also, each algorithm defines different config options:
175175 cost =" 15"
176176 />
177177
178- <!-- Argon2i encoder with default options -->
178+ <!-- Sodium encoder with default options -->
179179 <encoder
180180 class =" App\Entity\User"
181- algorithm =" argon2i "
181+ algorithm =" sodium "
182182 />
183183
184- <!-- Argon2i encoder with custom options -->
184+ <!-- Sodium encoder with custom options -->
185185 <!-- memory_cost: amount in KiB. (16384 = 16 MiB)
186186 time_cost: number of iterations
187187 threads: number of parallel threads -->
188188 <encoder
189189 class =" App\Entity\User"
190- algorithm =" argon2i "
190+ algorithm =" sodium "
191191 memory_cost =" 16384"
192192 time_cost =" 2"
193193 threads =" 4"
@@ -220,14 +220,14 @@ encoding algorithm. Also, each algorithm defines different config options:
220220 'cost' => 15,
221221 ],
222222
223- // Argon2i encoder with default options
223+ // Sodium encoder with default options
224224 User::class => [
225- 'algorithm' => 'argon2i ',
225+ 'algorithm' => 'sodium ',
226226 ],
227227
228- // Argon2i encoder with custom options
228+ // Sodium encoder with custom options
229229 User::class => [
230- 'algorithm' => 'argon2i ',
230+ 'algorithm' => 'sodium ',
231231 'memory_cost' => 16384, // Amount in KiB. (16384 = 16 MiB)
232232 'time_cost' => 2, // Number of iterations
233233 'threads' => 4, // Number of parallel threads
@@ -240,16 +240,27 @@ encoding algorithm. Also, each algorithm defines different config options:
240240 ],
241241 ]);
242242
243+ .. versionadded :: 4.3
244+
245+ The ``sodium `` algorithm was introduced in Symfony 4.3. In previous Symfony
246+ versions it was called ``argon2i ``.
247+
243248.. tip ::
244249
245250 You can also create your own password encoders as services and you can even
246251 select a different password encoder for each user instance. Read
247252 :doc: `this article </security/named_encoders >` for more details.
248253
249- .. _reference-security-argon2i :
254+ .. _reference-security-sodium :
255+ .. _using-the-argon2i-password-encoder :
256+
257+ Using the Sodium Password Encoder
258+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259+
260+ .. versionadded :: 4.3
250261
251- Using the Argon2i Password Encoder
252- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
262+ The `` SodiumPasswordEncoder `` was introduced in Symfony 4.3. In previous
263+ Symfony versions it was called `` Argon2iPasswordEncoder ``.
253264
254265It uses the `Argon2 key derivation function `_ and it's the encoder recommended
255266by Symfony. Argon2 support was introduced in PHP 7.2, but if you use an earlier
@@ -267,7 +278,7 @@ Using the BCrypt Password Encoder
267278~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
268279
269280It uses the `bcrypt password hashing function `_ and it's recommended to use it
270- when it's not possible to use Argon2i . The encoded passwords are ``60 ``
281+ when it's not possible to use Sodium . The encoded passwords are ``60 ``
271282characters long, so make sure to allocate enough space for them to be persisted.
272283Also, passwords include the `cryptographic salt `_ inside them (it's generated
273284automatically for each new password) so you don't have to deal with it.
@@ -294,7 +305,7 @@ Using the PBKDF2 Encoder
294305~~~~~~~~~~~~~~~~~~~~~~~~
295306
296307Using the `PBKDF2 `_ encoder is no longer recommended since PHP added support for
297- Argon2i and bcrypt. Legacy application still using it are encouraged to upgrade
308+ Sodium and bcrypt. Legacy application still using it are encouraged to upgrade
298309to those newer encoding algorithms.
299310
300311firewalls
0 commit comments