diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2018-09-11 01:07:19 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2018-09-11 01:07:19 (GMT) |
commit | 959625b5a56545f1908a7002fe11eb4f0411b780 (patch) | |
tree | 9fd53b021eaa40faa584da4bf512a91804b9c8eb | |
parent | e578fa162eef1cef27bc7dbf7ca46ab6dc52688a (diff) | |
download | cpython-959625b5a56545f1908a7002fe11eb4f0411b780.zip cpython-959625b5a56545f1908a7002fe11eb4f0411b780.tar.gz cpython-959625b5a56545f1908a7002fe11eb4f0411b780.tar.bz2 |
Use bytes.hex instead of binascii.hexlify in pbkdf2_hmac example (GH-8420)
-rw-r--r-- | Doc/library/hashlib.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index baf6b0a..4a8d705 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -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 |