gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

458 lines
27KB

  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <meta property="og:title" content="hmac — Keyed-Hashing for Message Authentication" />
  7. <meta property="og:type" content="website" />
  8. <meta property="og:url" content="https://docs.python.org/3/library/hmac.html" />
  9. <meta property="og:site_name" content="Python documentation" />
  10. <meta property="og:description" content="Source code: Lib/hmac.py This module implements the HMAC algorithm as described by RFC 2104. An HMAC object has the following methods: A hash object has the following attributes: This module also p..." />
  11. <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" />
  12. <meta property="og:image:alt" content="Python documentation" />
  13. <meta name="description" content="Source code: Lib/hmac.py This module implements the HMAC algorithm as described by RFC 2104. An HMAC object has the following methods: A hash object has the following attributes: This module also p..." />
  14. <meta property="og:image:width" content="200" />
  15. <meta property="og:image:height" content="200" />
  16. <meta name="theme-color" content="#3776ab" />
  17. <title>hmac — Keyed-Hashing for Message Authentication &#8212; Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
  18. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" />
  19. <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" />
  20. <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" />
  21. <script src="../_static/documentation_options.js?v=2c828074"></script>
  22. <script src="../_static/doctools.js?v=888ff710"></script>
  23. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  24. <script src="../_static/sidebar.js"></script>
  25. <link rel="search" type="application/opensearchdescription+xml"
  26. title="Search within Python 3.12.3 documentation"
  27. href="../_static/opensearch.xml"/>
  28. <link rel="author" title="About these documents" href="../about.html" />
  29. <link rel="index" title="Index" href="../genindex.html" />
  30. <link rel="search" title="Search" href="../search.html" />
  31. <link rel="copyright" title="Copyright" href="../copyright.html" />
  32. <link rel="next" title="secrets — Generate secure random numbers for managing secrets" href="secrets.html" />
  33. <link rel="prev" title="hashlib — Secure hashes and message digests" href="hashlib.html" />
  34. <link rel="canonical" href="https://docs.python.org/3/library/hmac.html" />
  35. <style>
  36. @media only screen {
  37. table.full-width-table {
  38. width: 100%;
  39. }
  40. }
  41. </style>
  42. <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css">
  43. <link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
  44. <script type="text/javascript" src="../_static/copybutton.js"></script>
  45. <script type="text/javascript" src="../_static/menu.js"></script>
  46. <script type="text/javascript" src="../_static/search-focus.js"></script>
  47. <script type="text/javascript" src="../_static/themetoggle.js"></script>
  48. </head>
  49. <body>
  50. <div class="mobile-nav">
  51. <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
  52. aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
  53. <nav class="nav-content" role="navigation">
  54. <label for="menuToggler" class="toggler__label">
  55. <span></span>
  56. </label>
  57. <span class="nav-items-wrapper">
  58. <a href="https://www.python.org/" class="nav-logo">
  59. <img src="../_static/py.svg" alt="Python logo"/>
  60. </a>
  61. <span class="version_switcher_placeholder"></span>
  62. <form role="search" class="search" action="../search.html" method="get">
  63. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
  64. <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
  65. </svg>
  66. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" />
  67. <input type="submit" value="Go"/>
  68. </form>
  69. </span>
  70. </nav>
  71. <div class="menu-wrapper">
  72. <nav class="menu" role="navigation" aria-label="main navigation">
  73. <div class="language_switcher_placeholder"></div>
  74. <label class="theme-selector-label">
  75. Theme
  76. <select class="theme-selector" oninput="activateTheme(this.value)">
  77. <option value="auto" selected>Auto</option>
  78. <option value="light">Light</option>
  79. <option value="dark">Dark</option>
  80. </select>
  81. </label>
  82. <div>
  83. <h4>Previous topic</h4>
  84. <p class="topless"><a href="hashlib.html"
  85. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code> — Secure hashes and message digests</a></p>
  86. </div>
  87. <div>
  88. <h4>Next topic</h4>
  89. <p class="topless"><a href="secrets.html"
  90. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">secrets</span></code> — Generate secure random numbers for managing secrets</a></p>
  91. </div>
  92. <div role="note" aria-label="source link">
  93. <h3>This Page</h3>
  94. <ul class="this-page-menu">
  95. <li><a href="../bugs.html">Report a Bug</a></li>
  96. <li>
  97. <a href="https://github.com/python/cpython/blob/main/Doc/library/hmac.rst"
  98. rel="nofollow">Show Source
  99. </a>
  100. </li>
  101. </ul>
  102. </div>
  103. </nav>
  104. </div>
  105. </div>
  106. <div class="related" role="navigation" aria-label="related navigation">
  107. <h3>Navigation</h3>
  108. <ul>
  109. <li class="right" style="margin-right: 10px">
  110. <a href="../genindex.html" title="General Index"
  111. accesskey="I">index</a></li>
  112. <li class="right" >
  113. <a href="../py-modindex.html" title="Python Module Index"
  114. >modules</a> |</li>
  115. <li class="right" >
  116. <a href="secrets.html" title="secrets — Generate secure random numbers for managing secrets"
  117. accesskey="N">next</a> |</li>
  118. <li class="right" >
  119. <a href="hashlib.html" title="hashlib — Secure hashes and message digests"
  120. accesskey="P">previous</a> |</li>
  121. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  122. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  123. <li class="switchers">
  124. <div class="language_switcher_placeholder"></div>
  125. <div class="version_switcher_placeholder"></div>
  126. </li>
  127. <li>
  128. </li>
  129. <li id="cpython-language-and-version">
  130. <a href="../index.html">3.12.3 Documentation</a> &#187;
  131. </li>
  132. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  133. <li class="nav-item nav-item-2"><a href="crypto.html" accesskey="U">Cryptographic Services</a> &#187;</li>
  134. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">hmac</span></code> — Keyed-Hashing for Message Authentication</a></li>
  135. <li class="right">
  136. <div class="inline-search" role="search">
  137. <form class="inline-search" action="../search.html" method="get">
  138. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  139. <input type="submit" value="Go" />
  140. </form>
  141. </div>
  142. |
  143. </li>
  144. <li class="right">
  145. <label class="theme-selector-label">
  146. Theme
  147. <select class="theme-selector" oninput="activateTheme(this.value)">
  148. <option value="auto" selected>Auto</option>
  149. <option value="light">Light</option>
  150. <option value="dark">Dark</option>
  151. </select>
  152. </label> |</li>
  153. </ul>
  154. </div>
  155. <div class="document">
  156. <div class="documentwrapper">
  157. <div class="bodywrapper">
  158. <div class="body" role="main">
  159. <section id="module-hmac">
  160. <span id="hmac-keyed-hashing-for-message-authentication"></span><h1><a class="reference internal" href="#module-hmac" title="hmac: Keyed-Hashing for Message Authentication (HMAC) implementation"><code class="xref py py-mod docutils literal notranslate"><span class="pre">hmac</span></code></a> — Keyed-Hashing for Message Authentication<a class="headerlink" href="#module-hmac" title="Link to this heading">¶</a></h1>
  161. <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/hmac.py">Lib/hmac.py</a></p>
  162. <hr class="docutils" />
  163. <p>This module implements the HMAC algorithm as described by <span class="target" id="index-0"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2104.html"><strong>RFC 2104</strong></a>.</p>
  164. <dl class="py function">
  165. <dt class="sig sig-object py" id="hmac.new">
  166. <span class="sig-prename descclassname"><span class="pre">hmac.</span></span><span class="sig-name descname"><span class="pre">new</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg=None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">digestmod</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#hmac.new" title="Link to this definition">¶</a></dt>
  167. <dd><p>Return a new hmac object. <em>key</em> is a bytes or bytearray object giving the
  168. secret key. If <em>msg</em> is present, the method call <code class="docutils literal notranslate"><span class="pre">update(msg)</span></code> is made.
  169. <em>digestmod</em> is the digest name, digest constructor or module for the HMAC
  170. object to use. It may be any name suitable to <a class="reference internal" href="hashlib.html#hashlib.new" title="hashlib.new"><code class="xref py py-func docutils literal notranslate"><span class="pre">hashlib.new()</span></code></a>.
  171. Despite its argument position, it is required.</p>
  172. <div class="versionchanged">
  173. <p><span class="versionmodified changed">Changed in version 3.4: </span>Parameter <em>key</em> can be a bytes or bytearray object.
  174. Parameter <em>msg</em> can be of any type supported by <a class="reference internal" href="hashlib.html#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code></a>.
  175. Parameter <em>digestmod</em> can be the name of a hash algorithm.</p>
  176. </div>
  177. <div class="versionchanged">
  178. <p><span class="versionmodified changed">Changed in version 3.8: </span>The <em>digestmod</em> argument is now required. Pass it as a keyword
  179. argument to avoid awkwardness when you do not have an initial <em>msg</em>.</p>
  180. </div>
  181. </dd></dl>
  182. <dl class="py function">
  183. <dt class="sig sig-object py" id="hmac.digest">
  184. <span class="sig-prename descclassname"><span class="pre">hmac.</span></span><span class="sig-name descname"><span class="pre">digest</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">msg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">digest</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#hmac.digest" title="Link to this definition">¶</a></dt>
  185. <dd><p>Return digest of <em>msg</em> for given secret <em>key</em> and <em>digest</em>. The
  186. function is equivalent to <code class="docutils literal notranslate"><span class="pre">HMAC(key,</span> <span class="pre">msg,</span> <span class="pre">digest).digest()</span></code>, but
  187. uses an optimized C or inline implementation, which is faster for messages
  188. that fit into memory. The parameters <em>key</em>, <em>msg</em>, and <em>digest</em> have
  189. the same meaning as in <a class="reference internal" href="#hmac.new" title="hmac.new"><code class="xref py py-func docutils literal notranslate"><span class="pre">new()</span></code></a>.</p>
  190. <p>CPython implementation detail, the optimized C implementation is only used
  191. when <em>digest</em> is a string and name of a digest algorithm, which is
  192. supported by OpenSSL.</p>
  193. <div class="versionadded">
  194. <p><span class="versionmodified added">New in version 3.7.</span></p>
  195. </div>
  196. </dd></dl>
  197. <p>An HMAC object has the following methods:</p>
  198. <dl class="py method">
  199. <dt class="sig sig-object py" id="hmac.HMAC.update">
  200. <span class="sig-prename descclassname"><span class="pre">HMAC.</span></span><span class="sig-name descname"><span class="pre">update</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">msg</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#hmac.HMAC.update" title="Link to this definition">¶</a></dt>
  201. <dd><p>Update the hmac object with <em>msg</em>. Repeated calls are equivalent to a
  202. single call with the concatenation of all the arguments:
  203. <code class="docutils literal notranslate"><span class="pre">m.update(a);</span> <span class="pre">m.update(b)</span></code> is equivalent to <code class="docutils literal notranslate"><span class="pre">m.update(a</span> <span class="pre">+</span> <span class="pre">b)</span></code>.</p>
  204. <div class="versionchanged">
  205. <p><span class="versionmodified changed">Changed in version 3.4: </span>Parameter <em>msg</em> can be of any type supported by <a class="reference internal" href="hashlib.html#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code></a>.</p>
  206. </div>
  207. </dd></dl>
  208. <dl class="py method">
  209. <dt class="sig sig-object py" id="hmac.HMAC.digest">
  210. <span class="sig-prename descclassname"><span class="pre">HMAC.</span></span><span class="sig-name descname"><span class="pre">digest</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hmac.HMAC.digest" title="Link to this definition">¶</a></dt>
  211. <dd><p>Return the digest of the bytes passed to the <a class="reference internal" href="#hmac.HMAC.update" title="hmac.HMAC.update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">update()</span></code></a> method so far.
  212. This bytes object will be the same length as the <em>digest_size</em> of the digest
  213. given to the constructor. It may contain non-ASCII bytes, including NUL
  214. bytes.</p>
  215. <div class="admonition warning">
  216. <p class="admonition-title">Warning</p>
  217. <p>When comparing the output of <a class="reference internal" href="#hmac.digest" title="hmac.digest"><code class="xref py py-meth docutils literal notranslate"><span class="pre">digest()</span></code></a> to an externally supplied
  218. digest during a verification routine, it is recommended to use the
  219. <a class="reference internal" href="#hmac.compare_digest" title="hmac.compare_digest"><code class="xref py py-func docutils literal notranslate"><span class="pre">compare_digest()</span></code></a> function instead of the <code class="docutils literal notranslate"><span class="pre">==</span></code> operator
  220. to reduce the vulnerability to timing attacks.</p>
  221. </div>
  222. </dd></dl>
  223. <dl class="py method">
  224. <dt class="sig sig-object py" id="hmac.HMAC.hexdigest">
  225. <span class="sig-prename descclassname"><span class="pre">HMAC.</span></span><span class="sig-name descname"><span class="pre">hexdigest</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hmac.HMAC.hexdigest" title="Link to this definition">¶</a></dt>
  226. <dd><p>Like <a class="reference internal" href="#hmac.digest" title="hmac.digest"><code class="xref py py-meth docutils literal notranslate"><span class="pre">digest()</span></code></a> except the digest is returned as a string twice the
  227. length containing only hexadecimal digits. This may be used to exchange the
  228. value safely in email or other non-binary environments.</p>
  229. <div class="admonition warning">
  230. <p class="admonition-title">Warning</p>
  231. <p>When comparing the output of <a class="reference internal" href="#hmac.HMAC.hexdigest" title="hmac.HMAC.hexdigest"><code class="xref py py-meth docutils literal notranslate"><span class="pre">hexdigest()</span></code></a> to an externally supplied
  232. digest during a verification routine, it is recommended to use the
  233. <a class="reference internal" href="#hmac.compare_digest" title="hmac.compare_digest"><code class="xref py py-func docutils literal notranslate"><span class="pre">compare_digest()</span></code></a> function instead of the <code class="docutils literal notranslate"><span class="pre">==</span></code> operator
  234. to reduce the vulnerability to timing attacks.</p>
  235. </div>
  236. </dd></dl>
  237. <dl class="py method">
  238. <dt class="sig sig-object py" id="hmac.HMAC.copy">
  239. <span class="sig-prename descclassname"><span class="pre">HMAC.</span></span><span class="sig-name descname"><span class="pre">copy</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hmac.HMAC.copy" title="Link to this definition">¶</a></dt>
  240. <dd><p>Return a copy (“clone”) of the hmac object. This can be used to efficiently
  241. compute the digests of strings that share a common initial substring.</p>
  242. </dd></dl>
  243. <p>A hash object has the following attributes:</p>
  244. <dl class="py attribute">
  245. <dt class="sig sig-object py" id="hmac.HMAC.digest_size">
  246. <span class="sig-prename descclassname"><span class="pre">HMAC.</span></span><span class="sig-name descname"><span class="pre">digest_size</span></span><a class="headerlink" href="#hmac.HMAC.digest_size" title="Link to this definition">¶</a></dt>
  247. <dd><p>The size of the resulting HMAC digest in bytes.</p>
  248. </dd></dl>
  249. <dl class="py attribute">
  250. <dt class="sig sig-object py" id="hmac.HMAC.block_size">
  251. <span class="sig-prename descclassname"><span class="pre">HMAC.</span></span><span class="sig-name descname"><span class="pre">block_size</span></span><a class="headerlink" href="#hmac.HMAC.block_size" title="Link to this definition">¶</a></dt>
  252. <dd><p>The internal block size of the hash algorithm in bytes.</p>
  253. <div class="versionadded">
  254. <p><span class="versionmodified added">New in version 3.4.</span></p>
  255. </div>
  256. </dd></dl>
  257. <dl class="py attribute">
  258. <dt class="sig sig-object py" id="hmac.HMAC.name">
  259. <span class="sig-prename descclassname"><span class="pre">HMAC.</span></span><span class="sig-name descname"><span class="pre">name</span></span><a class="headerlink" href="#hmac.HMAC.name" title="Link to this definition">¶</a></dt>
  260. <dd><p>The canonical name of this HMAC, always lowercase, e.g. <code class="docutils literal notranslate"><span class="pre">hmac-md5</span></code>.</p>
  261. <div class="versionadded">
  262. <p><span class="versionmodified added">New in version 3.4.</span></p>
  263. </div>
  264. </dd></dl>
  265. <div class="versionchanged">
  266. <p><span class="versionmodified changed">Changed in version 3.10: </span>Removed the undocumented attributes <code class="docutils literal notranslate"><span class="pre">HMAC.digest_cons</span></code>, <code class="docutils literal notranslate"><span class="pre">HMAC.inner</span></code>,
  267. and <code class="docutils literal notranslate"><span class="pre">HMAC.outer</span></code>.</p>
  268. </div>
  269. <p>This module also provides the following helper function:</p>
  270. <dl class="py function">
  271. <dt class="sig sig-object py" id="hmac.compare_digest">
  272. <span class="sig-prename descclassname"><span class="pre">hmac.</span></span><span class="sig-name descname"><span class="pre">compare_digest</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">a</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">b</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#hmac.compare_digest" title="Link to this definition">¶</a></dt>
  273. <dd><p>Return <code class="docutils literal notranslate"><span class="pre">a</span> <span class="pre">==</span> <span class="pre">b</span></code>. This function uses an approach designed to prevent
  274. timing analysis by avoiding content-based short circuiting behaviour,
  275. making it appropriate for cryptography. <em>a</em> and <em>b</em> must both be of the
  276. same type: either <a class="reference internal" href="stdtypes.html#str" title="str"><code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></a> (ASCII only, as e.g. returned by
  277. <a class="reference internal" href="#hmac.HMAC.hexdigest" title="hmac.HMAC.hexdigest"><code class="xref py py-meth docutils literal notranslate"><span class="pre">HMAC.hexdigest()</span></code></a>), or a <a class="reference internal" href="../glossary.html#term-bytes-like-object"><span class="xref std std-term">bytes-like object</span></a>.</p>
  278. <div class="admonition note">
  279. <p class="admonition-title">Note</p>
  280. <p>If <em>a</em> and <em>b</em> are of different lengths, or if an error occurs,
  281. a timing attack could theoretically reveal information about the
  282. types and lengths of <em>a</em> and <em>b</em>—but not their values.</p>
  283. </div>
  284. <div class="versionadded">
  285. <p><span class="versionmodified added">New in version 3.3.</span></p>
  286. </div>
  287. <div class="versionchanged">
  288. <p><span class="versionmodified changed">Changed in version 3.10: </span>The function uses OpenSSL’s <code class="docutils literal notranslate"><span class="pre">CRYPTO_memcmp()</span></code> internally when
  289. available.</p>
  290. </div>
  291. </dd></dl>
  292. <div class="admonition seealso">
  293. <p class="admonition-title">See also</p>
  294. <dl class="simple">
  295. <dt>Module <a class="reference internal" href="hashlib.html#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code></a></dt><dd><p>The Python module providing secure hash functions.</p>
  296. </dd>
  297. </dl>
  298. </div>
  299. </section>
  300. <div class="clearer"></div>
  301. </div>
  302. </div>
  303. </div>
  304. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  305. <div class="sphinxsidebarwrapper">
  306. <div>
  307. <h4>Previous topic</h4>
  308. <p class="topless"><a href="hashlib.html"
  309. title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">hashlib</span></code> — Secure hashes and message digests</a></p>
  310. </div>
  311. <div>
  312. <h4>Next topic</h4>
  313. <p class="topless"><a href="secrets.html"
  314. title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">secrets</span></code> — Generate secure random numbers for managing secrets</a></p>
  315. </div>
  316. <div role="note" aria-label="source link">
  317. <h3>This Page</h3>
  318. <ul class="this-page-menu">
  319. <li><a href="../bugs.html">Report a Bug</a></li>
  320. <li>
  321. <a href="https://github.com/python/cpython/blob/main/Doc/library/hmac.rst"
  322. rel="nofollow">Show Source
  323. </a>
  324. </li>
  325. </ul>
  326. </div>
  327. </div>
  328. <div id="sidebarbutton" title="Collapse sidebar">
  329. <span>«</span>
  330. </div>
  331. </div>
  332. <div class="clearer"></div>
  333. </div>
  334. <div class="related" role="navigation" aria-label="related navigation">
  335. <h3>Navigation</h3>
  336. <ul>
  337. <li class="right" style="margin-right: 10px">
  338. <a href="../genindex.html" title="General Index"
  339. >index</a></li>
  340. <li class="right" >
  341. <a href="../py-modindex.html" title="Python Module Index"
  342. >modules</a> |</li>
  343. <li class="right" >
  344. <a href="secrets.html" title="secrets — Generate secure random numbers for managing secrets"
  345. >next</a> |</li>
  346. <li class="right" >
  347. <a href="hashlib.html" title="hashlib — Secure hashes and message digests"
  348. >previous</a> |</li>
  349. <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li>
  350. <li><a href="https://www.python.org/">Python</a> &#187;</li>
  351. <li class="switchers">
  352. <div class="language_switcher_placeholder"></div>
  353. <div class="version_switcher_placeholder"></div>
  354. </li>
  355. <li>
  356. </li>
  357. <li id="cpython-language-and-version">
  358. <a href="../index.html">3.12.3 Documentation</a> &#187;
  359. </li>
  360. <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
  361. <li class="nav-item nav-item-2"><a href="crypto.html" >Cryptographic Services</a> &#187;</li>
  362. <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">hmac</span></code> — Keyed-Hashing for Message Authentication</a></li>
  363. <li class="right">
  364. <div class="inline-search" role="search">
  365. <form class="inline-search" action="../search.html" method="get">
  366. <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" />
  367. <input type="submit" value="Go" />
  368. </form>
  369. </div>
  370. |
  371. </li>
  372. <li class="right">
  373. <label class="theme-selector-label">
  374. Theme
  375. <select class="theme-selector" oninput="activateTheme(this.value)">
  376. <option value="auto" selected>Auto</option>
  377. <option value="light">Light</option>
  378. <option value="dark">Dark</option>
  379. </select>
  380. </label> |</li>
  381. </ul>
  382. </div>
  383. <div class="footer">
  384. &copy;
  385. <a href="../copyright.html">
  386. Copyright
  387. </a>
  388. 2001-2024, Python Software Foundation.
  389. <br />
  390. This page is licensed under the Python Software Foundation License Version 2.
  391. <br />
  392. Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
  393. <br />
  394. See <a href="/license.html">History and License</a> for more information.<br />
  395. <br />
  396. The Python Software Foundation is a non-profit corporation.
  397. <a href="https://www.python.org/psf/donations/">Please donate.</a>
  398. <br />
  399. <br />
  400. Last updated on Apr 09, 2024 (13:47 UTC).
  401. <a href="/bugs.html">Found a bug</a>?
  402. <br />
  403. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.
  404. </div>
  405. </body>
  406. </html>
上海开阖软件有限公司 沪ICP备12045867号-1