From 5ac65d83ed9f2e64faf3a0c4f8c2bd9274d7f0d2 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 15 Nov 2022 18:56:38 +0300 Subject: [PATCH 1/2] gh-99502: mention `bytes` input in `secrets.compare_digest` --- Doc/library/secrets.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/secrets.rst b/Doc/library/secrets.rst index dc8e5f46fb581e..b85d86345b60a8 100644 --- a/Doc/library/secrets.rst +++ b/Doc/library/secrets.rst @@ -128,7 +128,8 @@ Other functions .. function:: compare_digest(a, b) - Return ``True`` if strings *a* and *b* are equal, otherwise ``False``, + Return ``True`` if strings or bytestrings + *a* and *b* are equal, otherwise ``False``, using a "constant-time compare" to reduce the risk of `timing attacks `_. See :func:`hmac.compare_digest` for additional details. From 4900a2c9460bbf4964ecea81ad2af674270bd7d8 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 24 Nov 2022 11:34:26 +0300 Subject: [PATCH 2/2] Update Doc/library/secrets.rst --- Doc/library/secrets.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/secrets.rst b/Doc/library/secrets.rst index b85d86345b60a8..4405dfc0535973 100644 --- a/Doc/library/secrets.rst +++ b/Doc/library/secrets.rst @@ -128,7 +128,8 @@ Other functions .. function:: compare_digest(a, b) - Return ``True`` if strings or bytestrings + Return ``True`` if strings or + :term:`bytes-like objects ` *a* and *b* are equal, otherwise ``False``, using a "constant-time compare" to reduce the risk of `timing attacks `_.