Skip to content

Commit 7f656c4

Browse files
authored
Update recommended PBKDF2HMAC iteration counts (#12608)
1 parent a6b2cd7 commit 7f656c4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/fernet.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ password through a key derivation function such as
238238
... algorithm=hashes.SHA256(),
239239
... length=32,
240240
... salt=salt,
241-
... iterations=1_000_000,
241+
... iterations=1_200_000,
242242
... )
243243
>>> key = base64.urlsafe_b64encode(kdf.derive(password))
244244
>>> f = Fernet(key)
@@ -252,7 +252,7 @@ In this scheme, the salt has to be stored in a retrievable location in order
252252
to derive the same key from the password in the future.
253253

254254
The iteration count used should be adjusted to be as high as your server can
255-
tolerate. A good default is at least 1,000,000 iterations, which is what `Django
255+
tolerate. A good default is at least 1,200,000 iterations, which is what `Django
256256
recommends as of January 2025`_.
257257

258258
Implementation

docs/hazmat/primitives/key-derivation-functions.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ PBKDF2
162162
... algorithm=hashes.SHA256(),
163163
... length=32,
164164
... salt=salt,
165-
... iterations=1_000_000,
165+
... iterations=1_200_000,
166166
... )
167167
>>> key = kdf.derive(b"my great password")
168168
>>> # verify
169169
>>> kdf = PBKDF2HMAC(
170170
... algorithm=hashes.SHA256(),
171171
... length=32,
172172
... salt=salt,
173-
... iterations=1_000_000,
173+
... iterations=1_200_000,
174174
... )
175175
>>> kdf.verify(b"my great password", key)
176176

0 commit comments

Comments
 (0)