~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-2.7.12-docs-html/library/hashlib.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
 
 
5
<html xmlns="http://www.w3.org/1999/xhtml">
 
6
  <head>
 
7
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
8
    
 
9
    <title>14.1. hashlib — Secure hashes and message digests &mdash; Python 2.7.12 documentation</title>
 
10
    
 
11
    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
 
12
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
 
13
    
 
14
    <script type="text/javascript">
 
15
      var DOCUMENTATION_OPTIONS = {
 
16
        URL_ROOT:    '../',
 
17
        VERSION:     '2.7.12',
 
18
        COLLAPSE_INDEX: false,
 
19
        FILE_SUFFIX: '.html',
 
20
        HAS_SOURCE:  true
 
21
      };
 
22
    </script>
 
23
    <script type="text/javascript" src="../_static/jquery.js"></script>
 
24
    <script type="text/javascript" src="../_static/underscore.js"></script>
 
25
    <script type="text/javascript" src="../_static/doctools.js"></script>
 
26
    <script type="text/javascript" src="../_static/sidebar.js"></script>
 
27
    <link rel="search" type="application/opensearchdescription+xml"
 
28
          title="Search within Python 2.7.12 documentation"
 
29
          href="../_static/opensearch.xml"/>
 
30
    <link rel="author" title="About these documents" href="../about.html" />
 
31
    <link rel="copyright" title="Copyright" href="../copyright.html" />
 
32
    <link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
 
33
    <link rel="up" title="14. Cryptographic Services" href="crypto.html" />
 
34
    <link rel="next" title="14.2. hmac — Keyed-Hashing for Message Authentication" href="hmac.html" />
 
35
    <link rel="prev" title="14. Cryptographic Services" href="crypto.html" />
 
36
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 
37
    <script type="text/javascript" src="../_static/copybutton.js"></script>
 
38
    <script type="text/javascript" src="../_static/version_switch.js"></script>
 
39
 
 
40
    
 
41
 
 
42
  </head>
 
43
  <body role="document">  
 
44
    <div class="related" role="navigation" aria-label="related navigation">
 
45
      <h3>Navigation</h3>
 
46
      <ul>
 
47
        <li class="right" style="margin-right: 10px">
 
48
          <a href="../genindex.html" title="General Index"
 
49
             accesskey="I">index</a></li>
 
50
        <li class="right" >
 
51
          <a href="../py-modindex.html" title="Python Module Index"
 
52
             >modules</a> |</li>
 
53
        <li class="right" >
 
54
          <a href="hmac.html" title="14.2. hmac — Keyed-Hashing for Message Authentication"
 
55
             accesskey="N">next</a> |</li>
 
56
        <li class="right" >
 
57
          <a href="crypto.html" title="14. Cryptographic Services"
 
58
             accesskey="P">previous</a> |</li>
 
59
        <li><img src="../_static/py.png" alt=""
 
60
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
61
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
62
        <li>
 
63
          <span class="version_switcher_placeholder">2.7.12</span>
 
64
          <a href="../index.html">Documentation</a> &raquo;
 
65
        </li>
 
66
 
 
67
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
68
          <li class="nav-item nav-item-2"><a href="crypto.html" accesskey="U">14. Cryptographic Services</a> &raquo;</li> 
 
69
      </ul>
 
70
    </div>    
 
71
 
 
72
    <div class="document">
 
73
      <div class="documentwrapper">
 
74
        <div class="bodywrapper">
 
75
          <div class="body" role="main">
 
76
            
 
77
  <div class="section" id="module-hashlib">
 
78
<span id="hashlib-secure-hashes-and-message-digests"></span><h1>14.1. <a class="reference internal" href="#module-hashlib" title="hashlib: Secure hash and message digest algorithms."><code class="xref py py-mod docutils literal"><span class="pre">hashlib</span></code></a> &#8212; Secure hashes and message digests<a class="headerlink" href="#module-hashlib" title="Permalink to this headline">¶</a></h1>
 
79
<div class="versionadded">
 
80
<p><span class="versionmodified">New in version 2.5.</span></p>
 
81
</div>
 
82
<p id="index-0"><strong>Source code:</strong> <a class="reference external" href="https://hg.python.org/cpython/file/2.7/Lib/hashlib.py">Lib/hashlib.py</a></p>
 
83
<hr class="docutils" />
 
84
<p>This module implements a common interface to many different secure hash and
 
85
message digest algorithms.  Included are the FIPS secure hash algorithms SHA1,
 
86
SHA224, SHA256, SHA384, and SHA512 (defined in FIPS 180-2) as well as RSA&#8217;s MD5
 
87
algorithm (defined in Internet <span class="target" id="index-1"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc1321.html"><strong>RFC 1321</strong></a>). The terms secure hash and message
 
88
digest are interchangeable.  Older algorithms were called message digests.  The
 
89
modern term is secure hash.</p>
 
90
<div class="admonition note">
 
91
<p class="first admonition-title">Note</p>
 
92
<p class="last">If you want the adler32 or crc32 hash functions, they are available in
 
93
the <a class="reference internal" href="zlib.html#module-zlib" title="zlib: Low-level interface to compression and decompression routines compatible with gzip."><code class="xref py py-mod docutils literal"><span class="pre">zlib</span></code></a> module.</p>
 
94
</div>
 
95
<div class="admonition warning">
 
96
<p class="first admonition-title">Warning</p>
 
97
<p class="last">Some algorithms have known hash collision weaknesses, refer to the &#8220;See
 
98
also&#8221; section at the end.</p>
 
99
</div>
 
100
<p>There is one constructor method named for each type of <em class="dfn">hash</em>.  All return
 
101
a hash object with the same simple interface. For example: use <code class="xref py py-func docutils literal"><span class="pre">sha1()</span></code> to
 
102
create a SHA1 hash object. You can now feed this object with arbitrary strings
 
103
using the <code class="xref py py-meth docutils literal"><span class="pre">update()</span></code> method.  At any point you can ask it for the
 
104
<em class="dfn">digest</em> of the concatenation of the strings fed to it so far using the
 
105
<code class="xref py py-meth docutils literal"><span class="pre">digest()</span></code> or <code class="xref py py-meth docutils literal"><span class="pre">hexdigest()</span></code> methods.</p>
 
106
<p id="index-2">Constructors for hash algorithms that are always present in this module are
 
107
<a class="reference internal" href="md5.html#module-md5" title="md5: RSA's MD5 message digest algorithm. (deprecated)"><code class="xref py py-func docutils literal"><span class="pre">md5()</span></code></a>, <code class="xref py py-func docutils literal"><span class="pre">sha1()</span></code>, <code class="xref py py-func docutils literal"><span class="pre">sha224()</span></code>, <code class="xref py py-func docutils literal"><span class="pre">sha256()</span></code>, <code class="xref py py-func docutils literal"><span class="pre">sha384()</span></code>, and
 
108
<code class="xref py py-func docutils literal"><span class="pre">sha512()</span></code>.  Additional algorithms may also be available depending upon the
 
109
OpenSSL library that Python uses on your platform.</p>
 
110
<p>For example, to obtain the digest of the string <code class="docutils literal"><span class="pre">'Nobody</span> <span class="pre">inspects</span> <span class="pre">the</span> <span class="pre">spammish</span>
 
111
<span class="pre">repetition'</span></code>:</p>
 
112
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">hashlib</span>
 
113
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span> <span class="o">=</span> <span class="n">hashlib</span><span class="o">.</span><span class="n">md5</span><span class="p">()</span>
 
114
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="s2">&quot;Nobody inspects&quot;</span><span class="p">)</span>
 
115
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="s2">&quot; the spammish repetition&quot;</span><span class="p">)</span>
 
116
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span><span class="o">.</span><span class="n">digest</span><span class="p">()</span>
 
117
<span class="go">&#39;\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9&#39;</span>
 
118
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span><span class="o">.</span><span class="n">digest_size</span>
 
119
<span class="go">16</span>
 
120
<span class="gp">&gt;&gt;&gt; </span><span class="n">m</span><span class="o">.</span><span class="n">block_size</span>
 
121
<span class="go">64</span>
 
122
</pre></div>
 
123
</div>
 
124
<p>More condensed:</p>
 
125
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">hashlib</span><span class="o">.</span><span class="n">sha224</span><span class="p">(</span><span class="s2">&quot;Nobody inspects the spammish repetition&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">hexdigest</span><span class="p">()</span>
 
126
<span class="go">&#39;a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2&#39;</span>
 
127
</pre></div>
 
128
</div>
 
129
<p>A generic <a class="reference internal" href="new.html#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><code class="xref py py-func docutils literal"><span class="pre">new()</span></code></a> constructor that takes the string name of the desired
 
130
algorithm as its first parameter also exists to allow access to the above listed
 
131
hashes as well as any other algorithms that your OpenSSL library may offer.  The
 
132
named constructors are much faster than <a class="reference internal" href="new.html#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><code class="xref py py-func docutils literal"><span class="pre">new()</span></code></a> and should be preferred.</p>
 
133
<p>Using <a class="reference internal" href="new.html#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><code class="xref py py-func docutils literal"><span class="pre">new()</span></code></a> with an algorithm provided by OpenSSL:</p>
 
134
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">h</span> <span class="o">=</span> <span class="n">hashlib</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">&#39;ripemd160&#39;</span><span class="p">)</span>
 
135
<span class="gp">&gt;&gt;&gt; </span><span class="n">h</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="s2">&quot;Nobody inspects the spammish repetition&quot;</span><span class="p">)</span>
 
136
<span class="gp">&gt;&gt;&gt; </span><span class="n">h</span><span class="o">.</span><span class="n">hexdigest</span><span class="p">()</span>
 
137
<span class="go">&#39;cc4a5ce1b3df48aec5d22d1f16b894a0b894eccc&#39;</span>
 
138
</pre></div>
 
139
</div>
 
140
<p>This module provides the following constant attribute:</p>
 
141
<dl class="data">
 
142
<dt id="hashlib.hashlib.algorithms">
 
143
<code class="descclassname">hashlib.</code><code class="descname">algorithms</code><a class="headerlink" href="#hashlib.hashlib.algorithms" title="Permalink to this definition">¶</a></dt>
 
144
<dd><p>A tuple providing the names of the hash algorithms guaranteed to be
 
145
supported by this module.</p>
 
146
<div class="versionadded">
 
147
<p><span class="versionmodified">New in version 2.7.</span></p>
 
148
</div>
 
149
</dd></dl>
 
150
 
 
151
<dl class="data">
 
152
<dt id="hashlib.algorithms_guaranteed">
 
153
<code class="descclassname">hashlib.</code><code class="descname">algorithms_guaranteed</code><a class="headerlink" href="#hashlib.algorithms_guaranteed" title="Permalink to this definition">¶</a></dt>
 
154
<dd><p>A set containing the names of the hash algorithms guaranteed to be supported
 
155
by this module on all platforms.</p>
 
156
<div class="versionadded">
 
157
<p><span class="versionmodified">New in version 2.7.9.</span></p>
 
158
</div>
 
159
</dd></dl>
 
160
 
 
161
<dl class="data">
 
162
<dt id="hashlib.algorithms_available">
 
163
<code class="descclassname">hashlib.</code><code class="descname">algorithms_available</code><a class="headerlink" href="#hashlib.algorithms_available" title="Permalink to this definition">¶</a></dt>
 
164
<dd><p>A set containing the names of the hash algorithms that are available in the
 
165
running Python interpreter.  These names will be recognized when passed to
 
166
<a class="reference internal" href="new.html#module-new" title="new: Interface to the creation of runtime implementation objects. (deprecated)"><code class="xref py py-func docutils literal"><span class="pre">new()</span></code></a>.  <a class="reference internal" href="#hashlib.algorithms_guaranteed" title="hashlib.algorithms_guaranteed"><code class="xref py py-attr docutils literal"><span class="pre">algorithms_guaranteed</span></code></a> will always be a subset.  The
 
167
same algorithm may appear multiple times in this set under different names
 
168
(thanks to OpenSSL).</p>
 
169
<div class="versionadded">
 
170
<p><span class="versionmodified">New in version 2.7.9.</span></p>
 
171
</div>
 
172
</dd></dl>
 
173
 
 
174
<p>The following values are provided as constant attributes of the hash objects
 
175
returned by the constructors:</p>
 
176
<dl class="data">
 
177
<dt id="hashlib.hash.digest_size">
 
178
<code class="descclassname">hash.</code><code class="descname">digest_size</code><a class="headerlink" href="#hashlib.hash.digest_size" title="Permalink to this definition">¶</a></dt>
 
179
<dd><p>The size of the resulting hash in bytes.</p>
 
180
</dd></dl>
 
181
 
 
182
<dl class="data">
 
183
<dt id="hashlib.hash.block_size">
 
184
<code class="descclassname">hash.</code><code class="descname">block_size</code><a class="headerlink" href="#hashlib.hash.block_size" title="Permalink to this definition">¶</a></dt>
 
185
<dd><p>The internal block size of the hash algorithm in bytes.</p>
 
186
</dd></dl>
 
187
 
 
188
<p>A hash object has the following methods:</p>
 
189
<dl class="method">
 
190
<dt id="hashlib.hash.update">
 
191
<code class="descclassname">hash.</code><code class="descname">update</code><span class="sig-paren">(</span><em>arg</em><span class="sig-paren">)</span><a class="headerlink" href="#hashlib.hash.update" title="Permalink to this definition">¶</a></dt>
 
192
<dd><p>Update the hash object with the string <em>arg</em>.  Repeated calls are equivalent to
 
193
a single call with the concatenation of all the arguments: <code class="docutils literal"><span class="pre">m.update(a);</span>
 
194
<span class="pre">m.update(b)</span></code> is equivalent to <code class="docutils literal"><span class="pre">m.update(a+b)</span></code>.</p>
 
195
<div class="versionchanged">
 
196
<p><span class="versionmodified">Changed in version 2.7: </span>The Python GIL is released to allow other threads to run while
 
197
hash updates on data larger than 2048 bytes is taking place when
 
198
using hash algorithms supplied by OpenSSL.</p>
 
199
</div>
 
200
</dd></dl>
 
201
 
 
202
<dl class="method">
 
203
<dt id="hashlib.hash.digest">
 
204
<code class="descclassname">hash.</code><code class="descname">digest</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hashlib.hash.digest" title="Permalink to this definition">¶</a></dt>
 
205
<dd><p>Return the digest of the strings passed to the <a class="reference internal" href="#hashlib.hash.update" title="hashlib.hash.update"><code class="xref py py-meth docutils literal"><span class="pre">update()</span></code></a> method so far.
 
206
This is a string of <a class="reference internal" href="#hashlib.hash.digest_size" title="hashlib.hash.digest_size"><code class="xref py py-attr docutils literal"><span class="pre">digest_size</span></code></a> bytes which may contain non-ASCII
 
207
characters, including null bytes.</p>
 
208
</dd></dl>
 
209
 
 
210
<dl class="method">
 
211
<dt id="hashlib.hash.hexdigest">
 
212
<code class="descclassname">hash.</code><code class="descname">hexdigest</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hashlib.hash.hexdigest" title="Permalink to this definition">¶</a></dt>
 
213
<dd><p>Like <a class="reference internal" href="#hashlib.hash.digest" title="hashlib.hash.digest"><code class="xref py py-meth docutils literal"><span class="pre">digest()</span></code></a> except the digest is returned as a string of double length,
 
214
containing only hexadecimal digits.  This may  be used to exchange the value
 
215
safely in email or other non-binary environments.</p>
 
216
</dd></dl>
 
217
 
 
218
<dl class="method">
 
219
<dt id="hashlib.hash.copy">
 
220
<code class="descclassname">hash.</code><code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#hashlib.hash.copy" title="Permalink to this definition">¶</a></dt>
 
221
<dd><p>Return a copy (&#8220;clone&#8221;) of the hash object.  This can be used to efficiently
 
222
compute the digests of strings that share a common initial substring.</p>
 
223
</dd></dl>
 
224
 
 
225
<div class="section" id="key-derivation">
 
226
<h2>14.1.1. Key derivation<a class="headerlink" href="#key-derivation" title="Permalink to this headline">¶</a></h2>
 
227
<p>Key derivation and key stretching algorithms are designed for secure password
 
228
hashing. Naive algorithms such as <code class="docutils literal"><span class="pre">sha1(password)</span></code> are not resistant against
 
229
brute-force attacks. A good password hashing function must be tunable, slow, and
 
230
include a <a class="reference external" href="https://en.wikipedia.org/wiki/Salt_%28cryptography%29">salt</a>.</p>
 
231
<dl class="function">
 
232
<dt id="hashlib.pbkdf2_hmac">
 
233
<code class="descclassname">hashlib.</code><code class="descname">pbkdf2_hmac</code><span class="sig-paren">(</span><em>name</em>, <em>password</em>, <em>salt</em>, <em>rounds</em>, <em>dklen=None</em><span class="sig-paren">)</span><a class="headerlink" href="#hashlib.pbkdf2_hmac" title="Permalink to this definition">¶</a></dt>
 
234
<dd><p>The function provides PKCS#5 password-based key derivation function 2. It
 
235
uses HMAC as pseudorandom function.</p>
 
236
<p>The string <em>name</em> is the desired name of the hash digest algorithm for
 
237
HMAC, e.g. &#8216;sha1&#8217; or &#8216;sha256&#8217;. <em>password</em> and <em>salt</em> are interpreted as
 
238
buffers of bytes. Applications and libraries should limit <em>password</em> to
 
239
a sensible value (e.g. 1024). <em>salt</em> should be about 16 or more bytes from
 
240
a proper source, e.g. <a class="reference internal" href="os.html#os.urandom" title="os.urandom"><code class="xref py py-func docutils literal"><span class="pre">os.urandom()</span></code></a>.</p>
 
241
<p>The number of <em>rounds</em> should be chosen based on the hash algorithm and
 
242
computing power. As of 2013, at least 100,000 rounds of SHA-256 is suggested.</p>
 
243
<p><em>dklen</em> is the length of the derived key. If <em>dklen</em> is <code class="docutils literal"><span class="pre">None</span></code> then the
 
244
digest size of the hash algorithm <em>name</em> is used, e.g. 64 for SHA-512.</p>
 
245
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">hashlib</span><span class="o">,</span> <span class="nn">binascii</span>
 
246
<span class="gp">&gt;&gt;&gt; </span><span class="n">dk</span> <span class="o">=</span> <span class="n">hashlib</span><span class="o">.</span><span class="n">pbkdf2_hmac</span><span class="p">(</span><span class="s1">&#39;sha256&#39;</span><span class="p">,</span> <span class="n">b</span><span class="s1">&#39;password&#39;</span><span class="p">,</span> <span class="n">b</span><span class="s1">&#39;salt&#39;</span><span class="p">,</span> <span class="mi">100000</span><span class="p">)</span>
 
247
<span class="gp">&gt;&gt;&gt; </span><span class="n">binascii</span><span class="o">.</span><span class="n">hexlify</span><span class="p">(</span><span class="n">dk</span><span class="p">)</span>
 
248
<span class="go">b&#39;0394a2ede332c9a13eb82e9b24631604c31df978b4e2f0fbd2c549944f9d79a5&#39;</span>
 
249
</pre></div>
 
250
</div>
 
251
<div class="versionadded">
 
252
<p><span class="versionmodified">New in version 2.7.8.</span></p>
 
253
</div>
 
254
<div class="admonition note">
 
255
<p class="first admonition-title">Note</p>
 
256
<p class="last">A fast implementation of <em>pbkdf2_hmac</em> is available with OpenSSL.  The
 
257
Python implementation uses an inline version of <a class="reference internal" href="hmac.html#module-hmac" title="hmac: Keyed-Hashing for Message Authentication (HMAC) implementation"><code class="xref py py-mod docutils literal"><span class="pre">hmac</span></code></a>. It is about
 
258
three times slower and doesn&#8217;t release the GIL.</p>
 
259
</div>
 
260
</dd></dl>
 
261
 
 
262
<div class="admonition seealso">
 
263
<p class="first admonition-title">See also</p>
 
264
<dl class="last docutils">
 
265
<dt>Module <a class="reference internal" href="hmac.html#module-hmac" title="hmac: Keyed-Hashing for Message Authentication (HMAC) implementation"><code class="xref py py-mod docutils literal"><span class="pre">hmac</span></code></a></dt>
 
266
<dd>A module to generate message authentication codes using hashes.</dd>
 
267
<dt>Module <a class="reference internal" href="base64.html#module-base64" title="base64: RFC 3548: Base16, Base32, Base64 Data Encodings"><code class="xref py py-mod docutils literal"><span class="pre">base64</span></code></a></dt>
 
268
<dd>Another way to encode binary hashes for non-binary environments.</dd>
 
269
<dt><a class="reference external" href="http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf">http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf</a></dt>
 
270
<dd>The FIPS 180-2 publication on Secure Hash Algorithms.</dd>
 
271
<dt><a class="reference external" href="https://en.wikipedia.org/wiki/Cryptographic_hash_function#Cryptographic_hash_algorithms">https://en.wikipedia.org/wiki/Cryptographic_hash_function#Cryptographic_hash_algorithms</a></dt>
 
272
<dd>Wikipedia article with information on which algorithms have known issues and
 
273
what that means regarding their use.</dd>
 
274
</dl>
 
275
</div>
 
276
</div>
 
277
</div>
 
278
 
 
279
 
 
280
          </div>
 
281
        </div>
 
282
      </div>
 
283
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
 
284
        <div class="sphinxsidebarwrapper">
 
285
  <h3><a href="../contents.html">Table Of Contents</a></h3>
 
286
  <ul>
 
287
<li><a class="reference internal" href="#">14.1. <code class="docutils literal"><span class="pre">hashlib</span></code> &#8212; Secure hashes and message digests</a><ul>
 
288
<li><a class="reference internal" href="#key-derivation">14.1.1. Key derivation</a></li>
 
289
</ul>
 
290
</li>
 
291
</ul>
 
292
 
 
293
  <h4>Previous topic</h4>
 
294
  <p class="topless"><a href="crypto.html"
 
295
                        title="previous chapter">14. Cryptographic Services</a></p>
 
296
  <h4>Next topic</h4>
 
297
  <p class="topless"><a href="hmac.html"
 
298
                        title="next chapter">14.2. <code class="docutils literal"><span class="pre">hmac</span></code> &#8212; Keyed-Hashing for Message Authentication</a></p>
 
299
<h3>This Page</h3>
 
300
<ul class="this-page-menu">
 
301
  <li><a href="../bugs.html">Report a Bug</a></li>
 
302
  <li><a href="../_sources/library/hashlib.txt"
 
303
         rel="nofollow">Show Source</a></li>
 
304
</ul>
 
305
 
 
306
<div id="searchbox" style="display: none" role="search">
 
307
  <h3>Quick search</h3>
 
308
    <form class="search" action="../search.html" method="get">
 
309
      <input type="text" name="q" />
 
310
      <input type="submit" value="Go" />
 
311
      <input type="hidden" name="check_keywords" value="yes" />
 
312
      <input type="hidden" name="area" value="default" />
 
313
    </form>
 
314
    <p class="searchtip" style="font-size: 90%">
 
315
    Enter search terms or a module, class or function name.
 
316
    </p>
 
317
</div>
 
318
<script type="text/javascript">$('#searchbox').show(0);</script>
 
319
        </div>
 
320
      </div>
 
321
      <div class="clearer"></div>
 
322
    </div>  
 
323
    <div class="related" role="navigation" aria-label="related navigation">
 
324
      <h3>Navigation</h3>
 
325
      <ul>
 
326
        <li class="right" style="margin-right: 10px">
 
327
          <a href="../genindex.html" title="General Index"
 
328
             >index</a></li>
 
329
        <li class="right" >
 
330
          <a href="../py-modindex.html" title="Python Module Index"
 
331
             >modules</a> |</li>
 
332
        <li class="right" >
 
333
          <a href="hmac.html" title="14.2. hmac — Keyed-Hashing for Message Authentication"
 
334
             >next</a> |</li>
 
335
        <li class="right" >
 
336
          <a href="crypto.html" title="14. Cryptographic Services"
 
337
             >previous</a> |</li>
 
338
        <li><img src="../_static/py.png" alt=""
 
339
                 style="vertical-align: middle; margin-top: -1px"/></li>
 
340
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
 
341
        <li>
 
342
          <span class="version_switcher_placeholder">2.7.12</span>
 
343
          <a href="../index.html">Documentation</a> &raquo;
 
344
        </li>
 
345
 
 
346
          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
 
347
          <li class="nav-item nav-item-2"><a href="crypto.html" >14. Cryptographic Services</a> &raquo;</li> 
 
348
      </ul>
 
349
    </div>  
 
350
    <div class="footer">
 
351
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
 
352
    <br />
 
353
    The Python Software Foundation is a non-profit corporation.
 
354
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
 
355
    <br />
 
356
    Last updated on Sep 20, 2016.
 
357
    <a href="../bugs.html">Found a bug</a>?
 
358
    <br />
 
359
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
 
360
    </div>
 
361
 
 
362
  </body>
 
363
</html>
 
 
b'\\ No newline at end of file'