diff options
author | Gregory P. Smith <greg@krypto.org> | 2022-05-05 16:48:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 16:48:17 (GMT) |
commit | 354ab7a5c812bf103f7aed5405f02fc81fda5b58 (patch) | |
tree | b6b7a83ac32c1a3d237810111f3202bdce4bfc93 /Doc | |
parent | 58573ffba0e4d3c7d6e6712169578e45d2926dbd (diff) | |
download | cpython-354ab7a5c812bf103f7aed5405f02fc81fda5b58.zip cpython-354ab7a5c812bf103f7aed5405f02fc81fda5b58.tar.gz cpython-354ab7a5c812bf103f7aed5405f02fc81fda5b58.tar.bz2 |
minor hashlib doc example cleanup. (#92340)
Closes #85465
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/hashlib.rst | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index da97b0e..57f270c 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -91,8 +91,8 @@ library that Python uses on your platform. On most platforms the Hashlib now uses SHA3 and SHAKE from OpenSSL 1.1.1 and newer. -For example, to obtain the digest of the byte string ``b'Nobody inspects the -spammish repetition'``:: +For example, to obtain the digest of the byte string ``b"Nobody inspects the +spammish repetition"``:: >>> import hashlib >>> m = hashlib.sha256() @@ -100,15 +100,13 @@ spammish repetition'``:: >>> m.update(b" the spammish repetition") >>> m.digest() b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf\x0c\x95\x0fK\x94\x06' - >>> m.digest_size - 32 - >>> m.block_size - 64 + >>> m.hexdigest() + '031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406' More condensed: - >>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest() - 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' + >>> hashlib.sha256(b"Nobody inspects the spammish repetition").hexdigest() + '031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406' .. function:: new(name[, data], *, usedforsecurity=True) |