This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Improve Keccak support in hashlib including KangarooTwelve
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Mariatta, christian.heimes, gregory.p.smith, gvanas
Priority: normal Keywords:

Created on 2020-02-03 10:25 by gvanas, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg361280 - (view) Author: Gilles Van Assche (gvanas) Date: 2020-02-03 10:25
Dear all,

I think it would be nice if hashlib would include the support of Keccak with a chosen suffix, as well as the fast instance KangarooTwelve (K12).

1) Currently, hashlib's interface for Keccak only supports the 6 instances of FIPS 202 (SHA3-* and SHAKE*). However, the instances in NIST SP 800-185 (cSHAKE, KMAC, …) use a different suffix and therefore cannot be instantiated on top of the aforementioned 6 instances. Instead, simply adding the suffix as an argument to the constructor would enable a user to instantiate plain Keccak (as in Ethereum) or the SP 800-185 instances.

2) K12 is an alternative hash function (and XOF) in the Keccak family. It is fast, parallelizable and it benefits directly from the cryptanalysis on the (unchanged) underlying permutation since 2008. This would be IMHO a valuable addition to hashlib. Among others, implementations of K12 can be found in the XKCP on GitHub.

Kind regards,
Gilles (co-designer of Keccak and K12)
msg361331 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2020-02-04 00:44
Added hashlib module experts.
msg361333 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-02-04 01:00
Christian added the SHA3 support so is probably best to comment on this. The way our hashlib code is structured we always use the https://github.com/python/cpython/tree/master/Modules/_sha3 implementation rather than OpenSSL for these algorithms due to the better functionality of that Keccak code.  So at first glance it should be reasonably straightforward to update it to accept an optional suffix constructor argument.

PR welcome.
History
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83720
2020-02-04 01:00:29gregory.p.smithsetmessages: + msg361333
stage: needs patch
2020-02-04 00:44:04Mariattasetnosy: + gregory.p.smith, christian.heimes, Mariatta
messages: + msg361331
2020-02-03 10:25:05gvanascreate