New submission from Marcelo <marcelog...@gmail.com>:

The documentation found in https://docs.python.org/2/library/hashlib.html

give us the following example:

```
More condensed:

>>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest()
'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
```

Although, we get the error if not encode the string:
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Unicode-objects must be encoded before hashing
```

So the example should be (string to bytes):
`hashlib.sha224(b"Nobody inspects the spammish repetition").hexdigest()`

----------
assignee: docs@python
components: Documentation
messages: 371354
nosy: docs@python, marcelog...@gmail.com
priority: normal
severity: normal
status: open
title: Fix the example in hashlib documentarion
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40960>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to