Skip to content

Commit 354ab7a

Browse files
authored
minor hashlib doc example cleanup. (#92340)
Closes #85465
1 parent 58573ff commit 354ab7a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Doc/library/hashlib.rst

+6-8
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,22 @@ library that Python uses on your platform. On most platforms the
9191

9292
Hashlib now uses SHA3 and SHAKE from OpenSSL 1.1.1 and newer.
9393

94-
For example, to obtain the digest of the byte string ``b'Nobody inspects the
95-
spammish repetition'``::
94+
For example, to obtain the digest of the byte string ``b"Nobody inspects the
95+
spammish repetition"``::
9696

9797
>>> import hashlib
9898
>>> m = hashlib.sha256()
9999
>>> m.update(b"Nobody inspects")
100100
>>> m.update(b" the spammish repetition")
101101
>>> m.digest()
102102
b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf\x0c\x95\x0fK\x94\x06'
103-
>>> m.digest_size
104-
32
105-
>>> m.block_size
106-
64
103+
>>> m.hexdigest()
104+
'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'
107105

108106
More condensed:
109107

110-
>>> hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()
111-
'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
108+
>>> hashlib.sha256(b"Nobody inspects the spammish repetition").hexdigest()
109+
'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'
112110

113111
.. function:: new(name[, data], *, usedforsecurity=True)
114112

0 commit comments

Comments
 (0)