Skip to content

Recommend Argon2id over PBKDF2HMAC as KDF#14724

Merged
reaperhulk merged 6 commits into
pyca:mainfrom
tmo1:patch-1
Apr 24, 2026
Merged

Recommend Argon2id over PBKDF2HMAC as KDF#14724
reaperhulk merged 6 commits into
pyca:mainfrom
tmo1:patch-1

Conversation

@tmo1

@tmo1 tmo1 commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Update the recommended PBKDF2HMAC iteration count from 1,200,000 to 1,500,000 to reflect the latest Django recommendations.

Closes: #14723

Update the recommended PBKDF2HMAC iteration count from 1,200,000 to 1,500,000 to reflect the latest Django recommendations.

Closes: pyca#14723
Comment thread docs/fernet.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to update the text here to match the link

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay - should I do that, or just follow your other suggestion and rewrite with Argon2id?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say let's just rewrite to use argon2id and leave PBKDF2 in the rear view mirror where it belongs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I'm new to RST, so I likely made some syntax errors - let me know if I need to make any changes.

tmo1 added 2 commits April 23, 2026 22:40
In the Fernet documentation, recommend Argon2id as opposed to other KDFs; replace the PBKDF2HMAC example with an Argon2id example; and discuss Argon2id parameter selection.

@60x20 60x20 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using 2048*1024 rather than 2**21 to make it more human-readable just like it is on the Argon2 docs.
Also the PR title should probably be changed to something like "Recommend Argon2 over PBKDF2 as KDF"

Comment thread docs/fernet.rst Outdated
Comment thread docs/fernet.rst Outdated
Comment thread docs/fernet.rst
... iterations=1_200_000,
... iterations=1,
... lanes=4,
... memory_cost=2**21

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
... memory_cost=2**21
... memory_cost=2048*1024

Wouldn't it be better if it was in a more human-readable form?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll obviously defer to whoever is in charge here, but the form I used is that of the RFC. I actually don't find either form that readable, since you have to remember that the figure is in KiB, and then mentally convert that into something like MiB or Gib :|

Comment thread docs/fernet.rst
The :class:`~cryptography.hazmat.primitives.kdf.argon2.Argon2id` parameters
in the above code example are based on the recommendations of `IRTF RFC 9106`_
for general applications. For memory-constrained applications, the RFC
recommends ``iterations=3`` and ``memory_cost=2**16``. See that document for

@60x20 60x20 Apr 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
recommends ``iterations=3`` and ``memory_cost=2**16``. See that document for
recommends ``iterations=3`` and ``memory_cost=64*1024``. See that document for

Like the previous suggestion

@tmo1 tmo1 changed the title Increase recommended PBKDF2HMAC iterations to 1,500,000 Recommend Argon2id over PBKDF2HMAC as KDF Apr 24, 2026
tmo1 and others added 2 commits April 24, 2026 10:00
Co-authored-by: 60x20 <120422100+60x20@users.noreply.github.com>
Co-authored-by: 60x20 <120422100+60x20@users.noreply.github.com>
Comment thread docs/fernet.rst Outdated
Co-authored-by: 60x20 <120422100+60x20@users.noreply.github.com>
@reaperhulk reaperhulk merged commit ef66de4 into pyca:main Apr 24, 2026
70 checks passed
@reaperhulk

Copy link
Copy Markdown
Member

Thank you!

@tmo1 tmo1 deleted the patch-1 branch April 27, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Please update PBKDF2HMAC minimum iterations recommendation

3 participants