classification
Title: document that hashlib.new takes kwargs
Type: enhancement Stage: patch review
Components: Documentation Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: christian.heimes, docs@python, gregory.p.smith, joernheissler, ta1hia
Priority: normal Keywords: patch

Created on 2019-01-19 09:51 by joernheissler, last changed 2019-09-11 09:29 by christian.heimes.

Pull Requests
URL Status Linked Edit
PR 15890 open ta1hia, 2019-09-10 22:20
Messages (3)
msg334053 - (view) Author: Jörn Heissler (joernheissler) * Date: 2019-01-19 09:51
This code works:
hashlib.new('blake2b', b'foo', digest_size=7)

https://github.com/python/cpython/blob/master/Lib/hashlib.py#L7
documents the function as: new(name, data=b'', **kwargs)

But the **kwargs argument is missing in https://docs.python.org/3/library/hashlib.html#hashlib.new and there aren't any examples either.
msg351747 - (view) Author: Tahia K (ta1hia) * Date: 2019-09-10 22:26
Hello,

I just submitted a small PR for this doc change, including the example provided by Jörn (thanks Jörn).
msg351777 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2019-09-11 09:29
Thanks for the bug report.

While you are technically correct, I would like to hold off on this change for a bit more. I plan to replace our internal vendored copies of sha3 and blake2 with OpenSSL code. OpenSSL 1.1.1 has some of the new required APIs. OpenSSL 3.0.0-dev is currently adding more but with slightly different semantic. For example OpenSSL does not have blake2b, but blake2b512 for hashing and blake2bmac for keyed hashing with salting and personalization.

I like to get integration with OpenSSL right until hashlib.new() is officially documented.
History
Date User Action Args
2019-09-11 09:29:23christian.heimessetassignee: docs@python -> christian.heimes
messages: + msg351777
versions: + Python 3.9
2019-09-10 22:26:31ta1hiasetnosy: + ta1hia
messages: + msg351747
2019-09-10 22:20:42ta1hiasetkeywords: + patch
stage: patch review
pull_requests: + pull_request15531
2019-01-19 10:58:12xtreaksetnosy: + gregory.p.smith, christian.heimes

versions: + Python 3.7, Python 3.8
2019-01-19 09:51:52joernheisslercreate