]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use bytes.hex instead of binascii.hexlify in pbkdf2_hmac example (GH-8420)
authorVille Skyttä <ville.skytta@iki.fi>
Tue, 11 Sep 2018 01:07:19 +0000 (04:07 +0300)
committerGregory P. Smith <greg@krypto.org>
Tue, 11 Sep 2018 01:07:19 +0000 (18:07 -0700)
Doc/library/hashlib.rst

index baf6b0af242cf583166625518a0c51cb19d4e0db..4a8d7058c68fdaf557e1aa5021d7bc0fb30fc9d6 100644 (file)
@@ -244,10 +244,10 @@ include a `salt <https://en.wikipedia.org/wiki/Salt_%28cryptography%29>`_.
    *dklen* is the length of the derived key. If *dklen* is ``None`` then the
    digest size of the hash algorithm *hash_name* is used, e.g. 64 for SHA-512.
 
-   >>> import hashlib, binascii
+   >>> import hashlib
    >>> dk = hashlib.pbkdf2_hmac('sha256', b'password', b'salt', 100000)
-   >>> binascii.hexlify(dk)
-   b'0394a2ede332c9a13eb82e9b24631604c31df978b4e2f0fbd2c549944f9d79a5'
+   >>> dk.hex()
+   '0394a2ede332c9a13eb82e9b24631604c31df978b4e2f0fbd2c549944f9d79a5'
 
    .. versionadded:: 3.4