classification
Title: Hashlib/blake2* missing 'data' keyword argument
Type: behavior Stage:
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Juuso Lehtivarjo, christian.heimes, docs@python, vstinner
Priority: normal Keywords:

Created on 2018-06-01 08:36 by Juuso Lehtivarjo, last changed 2018-07-11 14:19 by vstinner.

Messages (3)
msg318370 - (view) Author: Juuso Lehtivarjo (Juuso Lehtivarjo) Date: 2018-06-01 08:36
In python 3.6.5: hashlib blake2b/blake2s constructors do not recognize 'data' keyword. Try the following:

from hashlib import blake2b
print (blake2b(b"foobar").hexdigest()) # works
print (blake2b(data=b"foobar").hexdigest()) # TypeError: 'data' is an invalid keyword argument for this function
msg321414 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2018-07-11 08:02
None of the hashlib functions are taking keyword arguments for data:

>>> hashlib.sha256(data=b'foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: openssl_sha256() takes no keyword arguments
>>> hashlib.blake2b(data=b'foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'data' is an invalid keyword argument for this function
msg321455 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-11 14:19
> None of the hashlib functions are taking keyword arguments for data: ...

So it's just a documentation issue, no?

https://docs.python.org/dev/library/hashlib.html#creating-hash-objects

Juuso Lehtivarjo: do you want to write a pull request to fix the documentation?
History
Date User Action Args
2018-07-11 14:19:01vstinnersetnosy: + docs@python, vstinner
messages: + msg321455

assignee: docs@python
components: + Documentation
2018-07-11 08:02:42christian.heimessetmessages: + msg321414
versions: + Python 3.7, Python 3.8
2018-07-11 07:54:46serhiy.storchakasettype: crash -> behavior
2018-06-01 10:50:10ned.deilysetnosy: + christian.heimes
2018-06-01 08:36:11Juuso Lehtivarjocreate