summaryrefslogtreecommitdiffstats
path: root/Doc/library/hmac.rst
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-01 11:08:42 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-01 11:08:42 (GMT)
commit04926aeb2f88c39a25505e4a0474c6fb735e0f46 (patch)
treee2f8f58f84ec61dfb533a58320af98409c9b5c57 /Doc/library/hmac.rst
parentec4bdac8dd8c1a2fb6c211046dd0fca47a9896f2 (diff)
downloadcpython-04926aeb2f88c39a25505e4a0474c6fb735e0f46.zip
cpython-04926aeb2f88c39a25505e4a0474c6fb735e0f46.tar.gz
cpython-04926aeb2f88c39a25505e4a0474c6fb735e0f46.tar.bz2
Issue 18240: The HMAC module is no longer restricted to bytes and accepts
any bytes-like object, e.g. memoryview. Original patch by Jonas Borgström.
Diffstat (limited to 'Doc/library/hmac.rst')
-rw-r--r--Doc/library/hmac.rst18
1 files changed, 12 insertions, 6 deletions
diff --git a/Doc/library/hmac.rst b/Doc/library/hmac.rst
index c2066a7..4c707e9 100644
--- a/Doc/library/hmac.rst
+++ b/Doc/library/hmac.rst
@@ -16,20 +16,26 @@ This module implements the HMAC algorithm as described by :rfc:`2104`.
.. function:: new(key, msg=None, digestmod=None)
- Return a new hmac object. *key* is a bytes object giving the secret key. If
- *msg* is present, the method call ``update(msg)`` is made. *digestmod* is
- the digest constructor or module for the HMAC object to use. It defaults to
- the :func:`hashlib.md5` constructor.
+ Return a new hmac object. *key* is a bytes or bytearray object giving the
+ secret key. If *msg* is present, the method call ``update(msg)`` is made.
+ *digestmod* is the digest constructor or module for the HMAC object to use.
+ It defaults to the :func:`hashlib.md5` constructor.
+ .. versionchanged:: 3.4
+ Parameter *key* can be a bytes or bytearray object. Parameter *msg* can
+ be of any type supported by :mod:`hashlib`.
An HMAC object has the following methods:
.. method:: HMAC.update(msg)
- Update the hmac object with the bytes object *msg*. Repeated calls are
- equivalent to a single call with the concatenation of all the arguments:
+ Update the hmac object with *msg*. Repeated calls are equivalent to a
+ single call with the concatenation of all the arguments:
``m.update(a); m.update(b)`` is equivalent to ``m.update(a + b)``.
+ .. versionchanged:: 3.4
+ Parameter *msg* can be of any type supported by :mod:`hashlib`.
+
.. method:: HMAC.digest()