@@ -137,12 +137,12 @@ encoding algorithm. Also, each algorithm defines different config options:
137
137
algorithm : ' bcrypt'
138
138
cost : 15
139
139
140
- # Argon2i encoder with default options
141
- App\Entity\User : ' argon2i '
140
+ # Sodium encoder with default options
141
+ App\Entity\User : ' sodium '
142
142
143
- # Argon2i encoder with custom options
143
+ # Sodium encoder with custom options
144
144
App\Entity\User :
145
- algorithm : ' argon2i '
145
+ algorithm : ' sodium '
146
146
memory_cost : 16384 # Amount in KiB. (16384 = 16 MiB)
147
147
time_cost : 2 # Number of iterations
148
148
threads : 4 # Number of parallel threads
@@ -175,19 +175,19 @@ encoding algorithm. Also, each algorithm defines different config options:
175
175
cost =" 15"
176
176
/>
177
177
178
- <!-- Argon2i encoder with default options -->
178
+ <!-- Sodium encoder with default options -->
179
179
<encoder
180
180
class =" App\Entity\User"
181
- algorithm =" argon2i "
181
+ algorithm =" sodium "
182
182
/>
183
183
184
- <!-- Argon2i encoder with custom options -->
184
+ <!-- Sodium encoder with custom options -->
185
185
<!-- memory_cost: amount in KiB. (16384 = 16 MiB)
186
186
time_cost: number of iterations
187
187
threads: number of parallel threads -->
188
188
<encoder
189
189
class =" App\Entity\User"
190
- algorithm =" argon2i "
190
+ algorithm =" sodium "
191
191
memory_cost =" 16384"
192
192
time_cost =" 2"
193
193
threads =" 4"
@@ -220,14 +220,14 @@ encoding algorithm. Also, each algorithm defines different config options:
220
220
'cost' => 15,
221
221
],
222
222
223
- // Argon2i encoder with default options
223
+ // Sodium encoder with default options
224
224
User::class => [
225
- 'algorithm' => 'argon2i ',
225
+ 'algorithm' => 'sodium ',
226
226
],
227
227
228
- // Argon2i encoder with custom options
228
+ // Sodium encoder with custom options
229
229
User::class => [
230
- 'algorithm' => 'argon2i ',
230
+ 'algorithm' => 'sodium ',
231
231
'memory_cost' => 16384, // Amount in KiB. (16384 = 16 MiB)
232
232
'time_cost' => 2, // Number of iterations
233
233
'threads' => 4, // Number of parallel threads
@@ -240,16 +240,27 @@ encoding algorithm. Also, each algorithm defines different config options:
240
240
],
241
241
]);
242
242
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
+
243
248
.. tip ::
244
249
245
250
You can also create your own password encoders as services and you can even
246
251
select a different password encoder for each user instance. Read
247
252
:doc: `this article </security/named_encoders >` for more details.
248
253
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
250
261
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 ``.
253
264
254
265
It uses the `Argon2 key derivation function `_ and it's the encoder recommended
255
266
by Symfony. Argon2 support was introduced in PHP 7.2, but if you use an earlier
@@ -267,7 +278,7 @@ Using the BCrypt Password Encoder
267
278
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
268
279
269
280
It 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 ``
271
282
characters long, so make sure to allocate enough space for them to be persisted.
272
283
Also, passwords include the `cryptographic salt `_ inside them (it's generated
273
284
automatically for each new password) so you don't have to deal with it.
@@ -294,7 +305,7 @@ Using the PBKDF2 Encoder
294
305
~~~~~~~~~~~~~~~~~~~~~~~~
295
306
296
307
Using 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
298
309
to those newer encoding algorithms.
299
310
300
311
firewalls
0 commit comments