mirror of
https://github.com/python/cpython.git
synced 2025-11-13 07:26:31 +00:00
Use bytes.hex instead of binascii.hexlify in pbkdf2_hmac example (GH-8420)
This commit is contained in:
parent
e578fa162e
commit
959625b5a5
1 changed files with 3 additions and 3 deletions
|
|
@ -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
|
*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.
|
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)
|
>>> dk = hashlib.pbkdf2_hmac('sha256', b'password', b'salt', 100000)
|
||||||
>>> binascii.hexlify(dk)
|
>>> dk.hex()
|
||||||
b'0394a2ede332c9a13eb82e9b24631604c31df978b4e2f0fbd2c549944f9d79a5'
|
'0394a2ede332c9a13eb82e9b24631604c31df978b4e2f0fbd2c549944f9d79a5'
|
||||||
|
|
||||||
.. versionadded:: 3.4
|
.. versionadded:: 3.4
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue