[3.12] Clarify that dklen is expected in bytes for the hashlib functions (GH-106624) (GH-119384)

(cherry picked from commit 5adf78f546)

Co-authored-by: Mathijs Mortimer <thiezn@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-05-22 10:58:03 +02:00 committed by GitHub
parent 9801fbad67
commit 9bd9879ca7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -328,7 +328,7 @@ include a `salt <https://en.wikipedia.org/wiki/Salt_%28cryptography%29>`_.
your application, read *Appendix A.2.2* of NIST-SP-800-132_. The answers your application, read *Appendix A.2.2* of NIST-SP-800-132_. The answers
on the `stackexchange pbkdf2 iterations question`_ explain in detail. on the `stackexchange pbkdf2 iterations question`_ explain in detail.
*dklen* is the length of the derived key. If *dklen* is ``None`` then the *dklen* is the length of the derived key in bytes. If *dklen* is ``None`` then the
digest size of the hash algorithm *hash_name* is used, e.g. 64 for SHA-512. digest size of the hash algorithm *hash_name* is used, e.g. 64 for SHA-512.
>>> from hashlib import pbkdf2_hmac >>> from hashlib import pbkdf2_hmac
@ -357,7 +357,7 @@ include a `salt <https://en.wikipedia.org/wiki/Salt_%28cryptography%29>`_.
*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization *n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization
factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB).
*dklen* is the length of the derived key. *dklen* is the length of the derived key in bytes.
.. versionadded:: 3.6 .. versionadded:: 3.6