mirror of
https://github.com/python/cpython.git
synced 2025-08-20 00:32:12 +00:00

svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85617 | georg.brandl | 2010-10-17 12:09:06 +0200 (So, 17 Okt 2010) | 1 line #5212: md5 weaknesses do not affect hmac, so remove the note about that. ........ r85618 | georg.brandl | 2010-10-17 12:14:38 +0200 (So, 17 Okt 2010) | 1 line #9086: correct wrong terminology about linking with pythonXY.dll. ........ r85619 | georg.brandl | 2010-10-17 12:15:50 +0200 (So, 17 Okt 2010) | 1 line Make file names consistent. ........ r85620 | georg.brandl | 2010-10-17 12:22:28 +0200 (So, 17 Okt 2010) | 1 line Remove second parser module example; it referred to non-readily-available example files, and this kind of discovery is much better done with the AST nowadays anyway. ........ r85621 | georg.brandl | 2010-10-17 12:24:54 +0200 (So, 17 Okt 2010) | 1 line #9105: move pickle warning to a bit more prominent location. ........ r85622 | georg.brandl | 2010-10-17 12:28:04 +0200 (So, 17 Okt 2010) | 1 line #9112: document error() and exit() methods of ArgumentParser. ........ r85624 | georg.brandl | 2010-10-17 12:34:28 +0200 (So, 17 Okt 2010) | 1 line Some markup and style fixes in argparse docs. ........ r85626 | georg.brandl | 2010-10-17 12:38:20 +0200 (So, 17 Okt 2010) | 1 line #9117: fix syntax for class definition. ........ r85627 | georg.brandl | 2010-10-17 12:44:11 +0200 (So, 17 Okt 2010) | 1 line #9138: reword introduction to classes in Python. ........ r85629 | georg.brandl | 2010-10-17 12:51:45 +0200 (So, 17 Okt 2010) | 1 line #5962: clarify sys.exit() vs. threads. ........ r85631 | georg.brandl | 2010-10-17 12:53:54 +0200 (So, 17 Okt 2010) | 1 line Fix capitalization. ........ r85635 | georg.brandl | 2010-10-17 13:03:22 +0200 (So, 17 Okt 2010) | 1 line #5121: fix claims about default values leading to segfaults. ........ r85636 | georg.brandl | 2010-10-17 13:06:14 +0200 (So, 17 Okt 2010) | 1 line #9237: document sys.call_tracing(). ........ r85638 | georg.brandl | 2010-10-17 13:13:37 +0200 (So, 17 Okt 2010) | 1 line Port changes to pickle docs apparently lost in py3k. ........ r85639 | georg.brandl | 2010-10-17 13:23:56 +0200 (So, 17 Okt 2010) | 1 line Make twisted example a bit more logical. ........ r85641 | georg.brandl | 2010-10-17 13:29:07 +0200 (So, 17 Okt 2010) | 1 line Fix documentation of dis.opmap direction. ........ r85642 | georg.brandl | 2010-10-17 13:36:28 +0200 (So, 17 Okt 2010) | 1 line #9730: fix example. ........
57 lines
1.8 KiB
ReStructuredText
57 lines
1.8 KiB
ReStructuredText
|
|
:mod:`hmac` --- Keyed-Hashing for Message Authentication
|
|
========================================================
|
|
|
|
.. module:: hmac
|
|
:synopsis: Keyed-Hashing for Message Authentication (HMAC) implementation for Python.
|
|
.. moduleauthor:: Gerhard Häring <ghaering@users.sourceforge.net>
|
|
.. sectionauthor:: Gerhard Häring <ghaering@users.sourceforge.net>
|
|
|
|
|
|
.. versionadded:: 2.2
|
|
|
|
This module implements the HMAC algorithm as described by :rfc:`2104`.
|
|
|
|
|
|
.. function:: new(key[, msg[, digestmod]])
|
|
|
|
Return a new hmac object. 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.
|
|
|
|
|
|
An HMAC object has the following methods:
|
|
|
|
|
|
.. method:: hmac.update(msg)
|
|
|
|
Update the hmac object with the string *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)``.
|
|
|
|
|
|
.. method:: hmac.digest()
|
|
|
|
Return the digest of the strings passed to the :meth:`update` method so far.
|
|
This string will be the same length as the *digest_size* of the digest given to
|
|
the constructor. It may contain non-ASCII characters, including NUL bytes.
|
|
|
|
|
|
.. method:: hmac.hexdigest()
|
|
|
|
Like :meth:`digest` except the digest is returned as a string twice the length
|
|
containing only hexadecimal digits. This may be used to exchange the value
|
|
safely in email or other non-binary environments.
|
|
|
|
|
|
.. method:: hmac.copy()
|
|
|
|
Return a copy ("clone") of the hmac object. This can be used to efficiently
|
|
compute the digests of strings that share a common initial substring.
|
|
|
|
|
|
.. seealso::
|
|
|
|
Module :mod:`hashlib`
|
|
The Python module providing secure hash functions.
|
|
|