https://github.com/python/cpython/commit/1fc2e2aa920aa4daa2924a3dee9dfe1843ca0e9b commit: 1fc2e2aa920aa4daa2924a3dee9dfe1843ca0e9b branch: 3.10 author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com> committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com> date: 2022年11月26日T15:19:08+05:30 summary: [3.10] gh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512) (#99790) gh-99502: mention bytes-like objects as input in `secrets.compare_digest` (GH-99512) Now it is in sync with https://docs.python.org/3/library/hmac.htmlGH-hmac.compare_digest It is the same function, just re-exported. So, I guess they should mention the same input types. (cherry picked from commit 47d673d81fc315069c14f9438ebe61fb70ef1ccc) Co-authored-by: Nikita Sobolev <mail at sobolevn.me> Co-authored-by: Nikita Sobolev <mail at sobolevn.me> files: M Doc/library/secrets.rst diff --git a/Doc/library/secrets.rst b/Doc/library/secrets.rst index dc8e5f46fb58..4405dfc05359 100644 --- a/Doc/library/secrets.rst +++ b/Doc/library/secrets.rst @@ -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.