]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512)
authorNikita Sobolev <mail@sobolevn.me>
Sat, 26 Nov 2022 09:33:48 +0000 (12:33 +0300)
committerGitHub <noreply@github.com>
Sat, 26 Nov 2022 09:33:48 +0000 (01:33 -0800)
Now it is in sync with https://docs.python.org/3/library/hmac.html#hmac.compare_digest
It is the same function, just re-exported. So, I guess they should mention the same input types.

Doc/library/secrets.rst

index dc8e5f46fb581eac54280d6a7a09500af2d3c34d..4405dfc0535973ec2e3d233a9db33f47c4b9e36e 100644 (file)
@@ -128,7 +128,9 @@ Other functions
 
 .. function:: compare_digest(a, b)
 
-   Return ``True`` if strings *a* and *b* are equal, otherwise ``False``,
+   Return ``True`` if strings or
+   :term:`bytes-like objects <bytes-like object>`
+   *a* and *b* are equal, otherwise ``False``,
    using a "constant-time compare" to reduce the risk of
    `timing attacks <https://codahale.com/a-lesson-in-timing-attacks/>`_.
    See :func:`hmac.compare_digest` for additional details.