diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-02-26 00:41:38 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-02-26 00:41:38 (GMT) |
commit | de9b27d908400087796ab83dc25734a8cb75b526 (patch) | |
tree | f2b02a538e90432c77b499e34e8800b03d19af42 /Doc | |
parent | 6d6dd73aec5d594aefa9256999dbe2aab2caf06c (diff) | |
parent | bc85e35fe66edf18c7998d98bfa5682a9cbb0269 (diff) | |
download | cpython-de9b27d908400087796ab83dc25734a8cb75b526.zip cpython-de9b27d908400087796ab83dc25734a8cb75b526.tar.gz cpython-de9b27d908400087796ab83dc25734a8cb75b526.tar.bz2 |
Issue #26390: Merge pbkdf2_hmac() doc from 3.5
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/hashlib.rst | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index 769f96f..73a7555 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -185,22 +185,23 @@ brute-force attacks. A good password hashing function must be tunable, slow, and include a `salt <https://en.wikipedia.org/wiki/Salt_%28cryptography%29>`_. -.. function:: pbkdf2_hmac(name, password, salt, rounds, dklen=None) +.. function:: pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None) The function provides PKCS#5 password-based key derivation function 2. It uses HMAC as pseudorandom function. - The string *name* is the desired name of the hash digest algorithm for + The string *hash_name* is the desired name of the hash digest algorithm for HMAC, e.g. 'sha1' or 'sha256'. *password* and *salt* are interpreted as buffers of bytes. Applications and libraries should limit *password* to - a sensible value (e.g. 1024). *salt* should be about 16 or more bytes from + a sensible length (e.g. 1024). *salt* should be about 16 or more bytes from a proper source, e.g. :func:`os.urandom`. - The number of *rounds* should be chosen based on the hash algorithm and - computing power. As of 2013, at least 100,000 rounds of SHA-256 is suggested. + The number of *iterations* should be chosen based on the hash algorithm and + computing power. As of 2013, at least 100,000 iterations of SHA-256 are + suggested. *dklen* is the length of the derived key. If *dklen* is ``None`` then the - digest size of the hash algorithm *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. >>> import hashlib, binascii >>> dk = hashlib.pbkdf2_hmac('sha256', b'password', b'salt', 100000) |