403Webshell
Server IP : 178.105.222.151  /  Your IP : 216.73.216.38
Web Server : nginx/1.28.3
System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.5.4
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/doc/python3-passlib/html/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/python3-passlib/html/lib/passlib.utils.handlers.html
<!DOCTYPE html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

    <title>passlib.utils.handlers - Framework for writing password hashes &#8212; Passlib vlatest Documentation</title>
    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
    <link rel="stylesheet" type="text/css" href="../_static/classic.css?v=2bf1fcf8" />
    
    <script src="../_static/documentation_options.js?v=c6e86fd7"></script>
    <script src="../_static/doctools.js?v=9bcbadda"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    
    <link rel="icon" href="../_static/logo.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="next" title="passlib.utils.binary - Binary Helper Functions" href="passlib.utils.binary.html" />
    <link rel="prev" title="passlib.utils - Helper Functions" href="passlib.utils.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="passlib.utils.binary.html" title="passlib.utils.binary - Binary Helper Functions"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="passlib.utils.html" title="passlib.utils - Helper Functions"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">Passlib latest Documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >API Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="passlib.utils.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils</span></code> - Helper Functions</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.handlers</span></code> - Framework for writing password hashes</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-passlib.utils.handlers">
<span id="passlib-utils-handlers-framework-for-writing-password-hashes"></span><span id="index-0"></span><h1><a class="reference internal" href="#module-passlib.utils.handlers" title="passlib.utils.handlers: framework for writing password hashes"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.handlers</span></code></a> - Framework for writing password hashes<a class="headerlink" href="#module-passlib.utils.handlers" title="Link to this heading">¶</a></h1>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This module is primarily used as an internal support module.
Its interface has not been finalized yet, and may be changed somewhat
between major releases of Passlib, as the internal code is cleaned up
and simplified.</p>
</div>
<div class="admonition-todo admonition" id="id1">
<p class="admonition-title">Todo</p>
<p>This module, and the instructions on how to write a custom handler,
definitely need to be rewritten for clarity. They are not yet
organized, and may leave out some important details.</p>
</div>
<section id="implementing-custom-handlers">
<h2>Implementing Custom Handlers<a class="headerlink" href="#implementing-custom-handlers" title="Link to this heading">¶</a></h2>
<p>All that is required in order to write a custom handler that will work with
Passlib is to create an object (be it module, class, or object) that
exposes the functions and attributes required by the <a class="reference internal" href="passlib.ifc.html#password-hash-api"><span class="std std-ref">PasswordHash API</span></a>.
For classes, Passlib does not make any requirements about what a class instance
should look like (if the implementation even uses them).</p>
<p>That said, most of the handlers built into Passlib are based around the <a class="reference internal" href="#passlib.utils.handlers.GenericHandler" title="passlib.utils.handlers.GenericHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code></a>
class, and its associated mixin classes. While deriving from this class is not required,
doing so will greatly reduce the amount of additional code that is needed for
all but the most convoluted password hash schemes.</p>
<p>Once a handler has been written, it may be used explicitly, passed into
a <code class="xref py py-class docutils literal notranslate"><span class="pre">CryptContext</span></code> constructor, or registered
globally with Passlib via the <a class="reference internal" href="passlib.registry.html#module-passlib.registry" title="passlib.registry: registry for tracking password hash handlers."><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.registry</span></code></a> module.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#testing-hash-handlers"><span class="std std-ref">Testing Hash Handlers</span></a> for details about how to test
custom handlers against Passlib’s unittest suite.</p>
</div>
</section>
<section id="the-generichandler-class">
<h2>The GenericHandler Class<a class="headerlink" href="#the-generichandler-class" title="Link to this heading">¶</a></h2>
<section id="design">
<h3>Design<a class="headerlink" href="#design" title="Link to this heading">¶</a></h3>
<p>Most of the handlers built into Passlib are based around the <a class="reference internal" href="#passlib.utils.handlers.GenericHandler" title="passlib.utils.handlers.GenericHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code></a>
class. This class is designed under the assumption that the common
workflow for hashes is some combination of the following:</p>
<ol class="arabic simple">
<li><p>parse hash into constituent parts - performed by <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.from_string" title="passlib.utils.handlers.GenericHandler.from_string"><code class="xref py py-meth docutils literal notranslate"><span class="pre">from_string()</span></code></a>.</p></li>
<li><p>validate constituent parts - performed by <code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code>’s constructor,
and the normalization functions such as <a class="reference internal" href="#passlib.utils.handlers.GenericHandler._norm_checksum" title="passlib.utils.handlers.GenericHandler._norm_checksum"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_checksum()</span></code></a> and <a class="reference internal" href="#passlib.utils.handlers.HasSalt._norm_salt" title="passlib.utils.handlers.HasSalt._norm_salt"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_salt()</span></code></a>
which are provided by its related mixin classes.</p></li>
<li><p>calculate the raw checksum for a specific password - performed by <a class="reference internal" href="#passlib.utils.handlers.GenericHandler._calc_checksum" title="passlib.utils.handlers.GenericHandler._calc_checksum"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_calc_checksum()</span></code></a>.</p></li>
<li><p>assemble hash, including new checksum, into a new string - performed by <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.to_string" title="passlib.utils.handlers.GenericHandler.to_string"><code class="xref py py-meth docutils literal notranslate"><span class="pre">to_string()</span></code></a>.</p></li>
</ol>
<p>With this in mind, <code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code> provides implementations
of most of the <a class="reference internal" href="passlib.ifc.html#password-hash-api"><span class="std std-ref">PasswordHash API</span></a> methods, eliminating the need
for almost all the boilerplate associated with writing a password hash.</p>
<p>In order to minimize the amount of unneeded features that must be loaded in, the <code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code>
class itself contains only the parts which are needed by almost all handlers: parsing, rendering, and checksum validation.
Validation of all other parameters (such as salt, rounds, etc) is split out into separate
<a class="reference internal" href="#generic-handler-mixins"><span class="std std-ref">mixin classes</span></a> which enhance <code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code> with additional features.</p>
</section>
<section id="usage">
<h3>Usage<a class="headerlink" href="#usage" title="Link to this heading">¶</a></h3>
<p>In order to use <code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code>, just subclass it, and then do the following:</p>
<blockquote>
<div><ul>
<li><p>fill out the <code class="xref py py-attr docutils literal notranslate"><span class="pre">name</span></code> attribute with the name of your hash.</p></li>
<li><p>fill out the <code class="xref py py-attr docutils literal notranslate"><span class="pre">setting_kwds</span></code> attribute with a tuple listing
all the settings your hash accepts.</p></li>
<li><p>provide an implementation of the <code class="xref py py-meth docutils literal notranslate"><span class="pre">from_string()</span></code> classmethod.</p>
<p>this method should take in a potential hash string,
parse it into components, and return an instance of the class
which contains the parsed components. It should throw a <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code>
if no hash, or an invalid hash, is provided.</p>
</li>
<li><p>provide an implementation of the <code class="xref py py-meth docutils literal notranslate"><span class="pre">to_string()</span></code> instance method.</p>
<p>this method should render an instance of your handler class
(such as returned by <code class="xref py py-meth docutils literal notranslate"><span class="pre">from_string()</span></code>), returning
a hash string.</p>
</li>
<li><p>provide an implementation of the <code class="xref py py-meth docutils literal notranslate"><span class="pre">_calc_checksum()</span></code> instance method.</p>
<p>this is the heart of the hash; this method should take in the password
as the first argument, then generate and return the digest portion
of the hash, according to the settings (such as salt, etc) stored
in the parsed instance this method was called from.</p>
<p>note that it should not return the full hash with identifiers, etc;
that job should be performed by <code class="xref py py-meth docutils literal notranslate"><span class="pre">to_string()</span></code>.</p>
</li>
</ul>
</div></blockquote>
<p>Some additional notes:</p>
<blockquote>
<div><ul class="simple">
<li><p>In addition to simply subclassing <code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code>, most handlers
will also benefit from adding in some of the mixin classes
that are designed to add features to <code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code>.
See <a class="reference internal" href="#generic-handler-mixins"><span class="std std-ref">GenericHandler Mixins</span></a> for more details.</p></li>
<li><p>Most implementations will want to alter/override the default <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.identify" title="passlib.utils.handlers.GenericHandler.identify"><code class="xref py py-meth docutils literal notranslate"><span class="pre">identify()</span></code></a> method.
By default, it returns <code class="docutils literal notranslate"><span class="pre">True</span></code> for all hashes that <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.from_string" title="passlib.utils.handlers.GenericHandler.from_string"><code class="xref py py-meth docutils literal notranslate"><span class="pre">from_string()</span></code></a>
can parse without raising a <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code>; which is reliable, but somewhat slow.
For faster identification purposes, subclasses may fill in the <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.ident" title="passlib.utils.handlers.GenericHandler.ident"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ident</span></code></a> attribute
with the hash’s identifying prefix, which <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.identify" title="passlib.utils.handlers.GenericHandler.identify"><code class="xref py py-meth docutils literal notranslate"><span class="pre">identify()</span></code></a> will then test for
instead of calling <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.from_string" title="passlib.utils.handlers.GenericHandler.from_string"><code class="xref py py-meth docutils literal notranslate"><span class="pre">from_string()</span></code></a>.
For more complex situations, a custom implementation should be used;
the <a class="reference internal" href="#passlib.utils.handlers.HasManyIdents" title="passlib.utils.handlers.HasManyIdents"><code class="xref py py-class docutils literal notranslate"><span class="pre">HasManyIdents</span></code></a> mixin may also be helpful.</p></li>
<li><p>This class does not support context kwds of any type,
since that is a rare enough requirement inside passlib.</p></li>
</ul>
</div></blockquote>
</section>
<section id="interface">
<h3>Interface<a class="headerlink" href="#interface" title="Link to this heading">¶</a></h3>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">GenericHandler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">checksum</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_defaults</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler" title="Link to this definition">¶</a></dt>
<dd><p>helper class for implementing hash handlers.</p>
<p>GenericHandler-derived classes will have (at least) the following
constructor options, though others may be added by mixins
and by the class itself:</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>checksum</strong> – this should contain the digest portion of a
parsed hash (mainly provided when the constructor is called
by <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.from_string" title="passlib.utils.handlers.GenericHandler.from_string"><code class="xref py py-meth docutils literal notranslate"><span class="pre">from_string()</span></code></a>).
defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p></li>
<li><p><strong>use_defaults</strong> – <p>If <code class="docutils literal notranslate"><span class="pre">False</span></code> (the default), a <code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code> should be thrown
if any settings required by the handler were not explicitly provided.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, the handler should attempt to provide a default for any
missing values. This means generate missing salts, fill in default
cost parameters, etc.</p>
<p>This is typically only set to <code class="docutils literal notranslate"><span class="pre">True</span></code> when the constructor
is called by <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.hash" title="passlib.utils.handlers.GenericHandler.hash"><code class="xref py py-meth docutils literal notranslate"><span class="pre">hash()</span></code></a>, allowing user-provided values
to be handled in a more permissive manner.</p>
</p></li>
<li><p><strong>relaxed</strong> – <p>If <code class="docutils literal notranslate"><span class="pre">False</span></code> (the default), a <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> should be thrown
if any settings are out of bounds or otherwise invalid.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, they should be corrected if possible, and a warning
issue. If not possible, only then should an error be raised.
(e.g. under <code class="docutils literal notranslate"><span class="pre">relaxed=True</span></code>, rounds values will be clamped
to min/max rounds).</p>
<p>This is mainly used when parsing the config strings of certain
hashes, whose specifications implementations to be tolerant
of incorrect values in salt strings.</p>
</p></li>
</ul>
</dd>
</dl>
<section id="class-attributes">
<h4>Class Attributes<a class="headerlink" href="#class-attributes" title="Link to this heading">¶</a></h4>
<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.ident">
<span class="sig-name descname"><span class="pre">ident</span></span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.ident" title="Link to this definition">¶</a></dt>
<dd><p>[optional]
If this attribute is filled in, the default <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.identify" title="passlib.utils.handlers.GenericHandler.identify"><code class="xref py py-meth docutils literal notranslate"><span class="pre">identify()</span></code></a> method will use
it as a identifying prefix that can be used to recognize instances of this handler’s
hash. Filling this out is recommended for speed.</p>
<p>This should be a unicode str.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler._hash_regex">
<span class="sig-name descname"><span class="pre">_hash_regex</span></span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler._hash_regex" title="Link to this definition">¶</a></dt>
<dd><p>[optional]
If this attribute is filled in, the default <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.identify" title="passlib.utils.handlers.GenericHandler.identify"><code class="xref py py-meth docutils literal notranslate"><span class="pre">identify()</span></code></a> method
will use it to recognize instances of the hash. If <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.ident" title="passlib.utils.handlers.GenericHandler.ident"><code class="xref py py-attr docutils literal notranslate"><span class="pre">ident</span></code></a>
is specified, this will be ignored.</p>
<p>This should be a unique regex object.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.checksum_size">
<span class="sig-name descname"><span class="pre">checksum_size</span></span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.checksum_size" title="Link to this definition">¶</a></dt>
<dd><p>[optional]
Specifies the number of characters that should be expected in the checksum string.
If omitted, no check will be performed.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.checksum_chars">
<span class="sig-name descname"><span class="pre">checksum_chars</span></span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.checksum_chars" title="Link to this definition">¶</a></dt>
<dd><p>[optional]
A string listing all the characters allowed in the checksum string.
If omitted, no check will be performed.</p>
<p>This should be a unicode str.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler._stub_checksum">
<span class="sig-name descname"><span class="pre">_stub_checksum</span></span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler._stub_checksum" title="Link to this definition">¶</a></dt>
<dd><p>Placeholder checksum that will be used by genconfig()
in lieu of actually generating a hash for the empty string.
This should be a string of the same datatype as <a class="reference internal" href="#passlib.utils.handlers.GenericHandler.checksum" title="passlib.utils.handlers.GenericHandler.checksum"><code class="xref py py-attr docutils literal notranslate"><span class="pre">checksum</span></code></a>.</p>
</dd></dl>

</section>
<section id="instance-attributes">
<h4>Instance Attributes<a class="headerlink" href="#instance-attributes" title="Link to this heading">¶</a></h4>
<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.checksum">
<span class="sig-name descname"><span class="pre">checksum</span></span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.checksum" title="Link to this definition">¶</a></dt>
<dd><p>The checksum string provided to the constructor (after passing it
through <a class="reference internal" href="#passlib.utils.handlers.GenericHandler._norm_checksum" title="passlib.utils.handlers.GenericHandler._norm_checksum"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_checksum()</span></code></a>).</p>
</dd></dl>

</section>
<section id="required-subclass-methods">
<h4>Required Subclass Methods<a class="headerlink" href="#required-subclass-methods" title="Link to this heading">¶</a></h4>
<p>The following methods must be provided by handler subclass:</p>
<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.from_string">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_string</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">hash</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">context</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.from_string" title="Link to this definition">¶</a></dt>
<dd><p>return parsed instance from hash/configuration string</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>\*\*context</strong> – context keywords to pass to constructor (if applicable).</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>ValueError</strong> – if hash is incorrectly formatted</p>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>hash parsed into components,
for formatting / calculating checksum.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.to_string">
<span class="sig-name descname"><span class="pre">to_string</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.to_string" title="Link to this definition">¶</a></dt>
<dd><p>render instance to hash or configuration string</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p><p>hash string with salt &amp; digest included.</p>
<p>should return native str.</p>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler._calc_checksum">
<span class="sig-name descname"><span class="pre">_calc_checksum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">secret</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler._calc_checksum" title="Link to this definition">¶</a></dt>
<dd><p>given secret; calcuate and return encoded checksum portion of hash
string, taking config from object state</p>
<p>calc checksum implementations may assume secret is always
either str or bytes, checks are performed by verify/etc.</p>
</dd></dl>

</section>
<section id="default-methods">
<h4>Default Methods<a class="headerlink" href="#default-methods" title="Link to this heading">¶</a></h4>
<p>The following methods have default implementations that should work for
most cases, though they may be overridden if the hash subclass needs to:</p>
<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler._norm_checksum">
<span class="sig-name descname"><span class="pre">_norm_checksum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">checksum</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">relaxed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler._norm_checksum" title="Link to this definition">¶</a></dt>
<dd><p>validates checksum keyword against class requirements,
returns normalized version of checksum.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.genconfig">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">genconfig</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.genconfig" title="Link to this definition">¶</a></dt>
<dd><p>compile settings into a configuration string for genhash()</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 1.7: </span>As of 1.7, this method is deprecated, and slated for complete removal in Passlib 2.0.</p>
<p>For all known real-world uses, hashing a constant string
should provide equivalent functionality.</p>
<p>This deprecation may be reversed if a use-case presents itself in the mean time.</p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.genhash">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">genhash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">secret</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">config</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">context</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.genhash" title="Link to this definition">¶</a></dt>
<dd><p>generated hash for secret, using settings from config/hash string</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 1.7: </span>As of 1.7, this method is deprecated, and slated for complete removal in Passlib 2.0.</p>
<p>This deprecation may be reversed if a use-case presents itself in the mean time.</p>
</div>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.identify">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">identify</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">hash</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.identify" title="Link to this definition">¶</a></dt>
<dd><p>check if hash belongs to this scheme, returns True/False</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.hash">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">hash</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">secret</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.hash" title="Link to this definition">¶</a></dt>
<dd><p>Hash secret, returning result.
Should handle generating salt, etc, and should return string
containing identifier, salt &amp; other configuration, as well as digest.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>\*\*settings_kwds</strong> – <p>Pass in settings to customize configuration of resulting hash.</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 1.7: </span>Starting with Passlib 1.7, callers should no longer pass settings keywords
(e.g. <code class="docutils literal notranslate"><span class="pre">rounds</span></code> or <code class="docutils literal notranslate"><span class="pre">salt</span></code> directly to <code class="xref py py-meth docutils literal notranslate"><span class="pre">hash()</span></code>); should use
<code class="docutils literal notranslate"><span class="pre">.using(**settings).hash(secret)</span></code> construction instead.</p>
<p>Support will be removed in Passlib 2.0.</p>
</div>
</p></li>
<li><p><strong>\*\*context_kwds</strong> – Specific algorithms may require context-specific information (such as the user login).</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.GenericHandler.verify">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">verify</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">secret</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">hash</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">context</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.GenericHandler.verify" title="Link to this definition">¶</a></dt>
<dd><p>verify secret against hash, returns True/False</p>
</dd></dl>

</section>
</dd></dl>

</section>
<section id="generichandler-mixins">
<span id="generic-handler-mixins"></span><h3>GenericHandler Mixins<a class="headerlink" href="#generichandler-mixins" title="Link to this heading">¶</a></h3>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">HasSalt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">salt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasSalt" title="Link to this definition">¶</a></dt>
<dd><p>mixin for validating salts.</p>
<p>This <a class="reference internal" href="#passlib.utils.handlers.GenericHandler" title="passlib.utils.handlers.GenericHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code></a> mixin adds a <code class="docutils literal notranslate"><span class="pre">salt</span></code> keyword to the class constuctor;
any value provided is passed through the <a class="reference internal" href="#passlib.utils.handlers.HasSalt._norm_salt" title="passlib.utils.handlers.HasSalt._norm_salt"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_salt()</span></code></a> method,
which takes care of validating salt length and content,
as well as generating new salts if one it not provided.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>salt</strong> – optional salt string</p></li>
<li><p><strong>salt_size</strong> – optional size of salt (only used if no salt provided);
defaults to <a class="reference internal" href="#passlib.utils.handlers.HasSalt.default_salt_size" title="passlib.utils.handlers.HasSalt.default_salt_size"><code class="xref py py-attr docutils literal notranslate"><span class="pre">default_salt_size</span></code></a>.</p></li>
</ul>
</dd>
</dl>
<section id="id2">
<h4>Class Attributes<a class="headerlink" href="#id2" title="Link to this heading">¶</a></h4>
<p>In order for <code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_salt()</span></code> to do its job, the following
attributes should be provided by the handler subclass:</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt.min_salt_size">
<span class="sig-name descname"><span class="pre">min_salt_size</span></span><a class="headerlink" href="#passlib.utils.handlers.HasSalt.min_salt_size" title="Link to this definition">¶</a></dt>
<dd><p>The minimum number of characters allowed in a salt string.
An <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> will be throw if the provided salt is too small.
Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code>.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt.max_salt_size">
<span class="sig-name descname"><span class="pre">max_salt_size</span></span><a class="headerlink" href="#passlib.utils.handlers.HasSalt.max_salt_size" title="Link to this definition">¶</a></dt>
<dd><p>The maximum number of characters allowed in a salt string.
By default an <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> will be throw if the provided salt is
too large; but if <code class="docutils literal notranslate"><span class="pre">relaxed=True</span></code>, it will be clipped and a warning
issued instead. Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code>, for no maximum.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt.default_salt_size">
<span class="sig-name descname"><span class="pre">default_salt_size</span></span><a class="headerlink" href="#passlib.utils.handlers.HasSalt.default_salt_size" title="Link to this definition">¶</a></dt>
<dd><p>[required]
If no salt is provided, this should specify the size of the salt
that will be generated by <a class="reference internal" href="#passlib.utils.handlers.HasSalt._generate_salt" title="passlib.utils.handlers.HasSalt._generate_salt"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_generate_salt()</span></code></a>. By default
this will fall back to <a class="reference internal" href="#passlib.utils.handlers.HasSalt.max_salt_size" title="passlib.utils.handlers.HasSalt.max_salt_size"><code class="xref py py-attr docutils literal notranslate"><span class="pre">max_salt_size</span></code></a>.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt.salt_chars">
<span class="sig-name descname"><span class="pre">salt_chars</span></span><a class="headerlink" href="#passlib.utils.handlers.HasSalt.salt_chars" title="Link to this definition">¶</a></dt>
<dd><p>A string containing all the characters which are allowed in the salt
string. An <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> will be throw if any other characters
are encountered. May be set to <code class="docutils literal notranslate"><span class="pre">None</span></code> to skip this check (but see
in <a class="reference internal" href="#passlib.utils.handlers.HasSalt.default_salt_chars" title="passlib.utils.handlers.HasSalt.default_salt_chars"><code class="xref py py-attr docutils literal notranslate"><span class="pre">default_salt_chars</span></code></a>).</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt.default_salt_chars">
<span class="sig-name descname"><span class="pre">default_salt_chars</span></span><a class="headerlink" href="#passlib.utils.handlers.HasSalt.default_salt_chars" title="Link to this definition">¶</a></dt>
<dd><p>[required]
This attribute controls the set of characters use to generate
<em>new</em> salt strings. By default, it mirrors <a class="reference internal" href="#passlib.utils.handlers.HasSalt.salt_chars" title="passlib.utils.handlers.HasSalt.salt_chars"><code class="xref py py-attr docutils literal notranslate"><span class="pre">salt_chars</span></code></a>.
If <code class="xref py py-attr docutils literal notranslate"><span class="pre">salt_chars</span></code> is <code class="docutils literal notranslate"><span class="pre">None</span></code>, this attribute must be specified
in order to generate new salts. Aside from that purpose,
the main use of this attribute is for hashes which wish to generate
salts from a restricted subset of <code class="xref py py-attr docutils literal notranslate"><span class="pre">salt_chars</span></code>; such as
accepting all characters, but only using a-z.</p>
</dd></dl>

</section>
<section id="id3">
<h4>Instance Attributes<a class="headerlink" href="#id3" title="Link to this heading">¶</a></h4>
<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt.salt">
<span class="sig-name descname"><span class="pre">salt</span></span><a class="headerlink" href="#passlib.utils.handlers.HasSalt.salt" title="Link to this definition">¶</a></dt>
<dd><p>This instance attribute will be filled in with the salt provided
to the constructor (as adapted by <a class="reference internal" href="#passlib.utils.handlers.HasSalt._norm_salt" title="passlib.utils.handlers.HasSalt._norm_salt"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_salt()</span></code></a>)</p>
</dd></dl>

</section>
<section id="subclassable-methods">
<h4>Subclassable Methods<a class="headerlink" href="#subclassable-methods" title="Link to this heading">¶</a></h4>
<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt._norm_salt">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">_norm_salt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">salt</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">relaxed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasSalt._norm_salt" title="Link to this definition">¶</a></dt>
<dd><p>helper to normalize &amp; validate user-provided salt string</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>salt</strong> – salt string</p>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>TypeError</strong> – If salt not correct type.</p></li>
<li><p><strong>ValueError</strong> – <ul>
<li><p>if salt contains chars that aren’t in <a class="reference internal" href="#passlib.utils.handlers.HasSalt.salt_chars" title="passlib.utils.handlers.HasSalt.salt_chars"><code class="xref py py-attr docutils literal notranslate"><span class="pre">salt_chars</span></code></a>.</p></li>
<li><p>if salt contains less than <a class="reference internal" href="#passlib.utils.handlers.HasSalt.min_salt_size" title="passlib.utils.handlers.HasSalt.min_salt_size"><code class="xref py py-attr docutils literal notranslate"><span class="pre">min_salt_size</span></code></a> characters.</p></li>
<li><p>if <code class="docutils literal notranslate"><span class="pre">relaxed=False</span></code> and salt has more than <a class="reference internal" href="#passlib.utils.handlers.HasSalt.max_salt_size" title="passlib.utils.handlers.HasSalt.max_salt_size"><code class="xref py py-attr docutils literal notranslate"><span class="pre">max_salt_size</span></code></a>
characters (if <code class="docutils literal notranslate"><span class="pre">relaxed=True</span></code>, the salt is truncated
and a warning is issued instead).</p></li>
</ul>
</p></li>
</ul>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>normalized salt</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasSalt._generate_salt">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">_generate_salt</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasSalt._generate_salt" title="Link to this definition">¶</a></dt>
<dd><p>helper method for _init_salt(); generates a new random salt string.</p>
</dd></dl>

</section>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRounds">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">HasRounds</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rounds</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasRounds" title="Link to this definition">¶</a></dt>
<dd><p>mixin for validating rounds parameter</p>
<p>This <a class="reference internal" href="#passlib.utils.handlers.GenericHandler" title="passlib.utils.handlers.GenericHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">GenericHandler</span></code></a> mixin adds a <code class="docutils literal notranslate"><span class="pre">rounds</span></code> keyword to the class
constuctor; any value provided is passed through the <a class="reference internal" href="#passlib.utils.handlers.HasRounds._norm_rounds" title="passlib.utils.handlers.HasRounds._norm_rounds"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_rounds()</span></code></a>
method, which takes care of validating the number of rounds.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>rounds</strong> – optional number of rounds hash should use</p>
</dd>
</dl>
<section id="id4">
<h4>Class Attributes<a class="headerlink" href="#id4" title="Link to this heading">¶</a></h4>
<p>In order for <code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_rounds()</span></code> to do its job, the following
attributes must be provided by the handler subclass:</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRounds.min_rounds">
<span class="sig-name descname"><span class="pre">min_rounds</span></span><a class="headerlink" href="#passlib.utils.handlers.HasRounds.min_rounds" title="Link to this definition">¶</a></dt>
<dd><p>The minimum number of rounds allowed. A <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> will be
thrown if the rounds value is too small. Defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code>.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRounds.max_rounds">
<span class="sig-name descname"><span class="pre">max_rounds</span></span><a class="headerlink" href="#passlib.utils.handlers.HasRounds.max_rounds" title="Link to this definition">¶</a></dt>
<dd><p>The maximum number of rounds allowed. A <code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> will be
thrown if the rounds value is larger than this. Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code>
which indicates no limit to the rounds value.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRounds.default_rounds">
<span class="sig-name descname"><span class="pre">default_rounds</span></span><a class="headerlink" href="#passlib.utils.handlers.HasRounds.default_rounds" title="Link to this definition">¶</a></dt>
<dd><p>If no rounds value is provided to constructor, this value will be used.
If this is not specified, a rounds value <em>must</em> be specified by the
application.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRounds.rounds_cost">
<span class="sig-name descname"><span class="pre">rounds_cost</span></span><a class="headerlink" href="#passlib.utils.handlers.HasRounds.rounds_cost" title="Link to this definition">¶</a></dt>
<dd><p>[required]
The <code class="docutils literal notranslate"><span class="pre">rounds</span></code> parameter typically encodes a cpu-time cost
for calculating a hash. This should be set to <code class="docutils literal notranslate"><span class="pre">&quot;linear&quot;</span></code>
(the default) or <code class="docutils literal notranslate"><span class="pre">&quot;log2&quot;</span></code>, depending on how the rounds value relates
to the actual amount of time that will be required.</p>
</dd></dl>

</section>
<section id="class-methods">
<h4>Class Methods<a class="headerlink" href="#class-methods" title="Link to this heading">¶</a></h4>
<div class="admonition-todo admonition" id="id5">
<p class="admonition-title">Todo</p>
<p>document using() and needs_update() options</p>
</div>
</section>
<section id="id6">
<h4>Instance Attributes<a class="headerlink" href="#id6" title="Link to this heading">¶</a></h4>
<dl class="py attribute">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRounds.rounds">
<span class="sig-name descname"><span class="pre">rounds</span></span><a class="headerlink" href="#passlib.utils.handlers.HasRounds.rounds" title="Link to this definition">¶</a></dt>
<dd><p>This instance attribute will be filled in with the rounds value provided
to the constructor (as adapted by <a class="reference internal" href="#passlib.utils.handlers.HasRounds._norm_rounds" title="passlib.utils.handlers.HasRounds._norm_rounds"><code class="xref py py-meth docutils literal notranslate"><span class="pre">_norm_rounds()</span></code></a>)</p>
</dd></dl>

</section>
<section id="id7">
<h4>Subclassable Methods<a class="headerlink" href="#id7" title="Link to this heading">¶</a></h4>
<dl class="py method">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRounds._norm_rounds">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">_norm_rounds</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rounds</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">relaxed</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">param</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'rounds'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasRounds._norm_rounds" title="Link to this definition">¶</a></dt>
<dd><p>helper for normalizing rounds value.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>rounds</strong> – an integer cost parameter.</p></li>
<li><p><strong>relaxed</strong> – if <code class="docutils literal notranslate"><span class="pre">True</span></code> (the default), issues PasslibHashWarning is rounds are outside allowed range.
if <code class="docutils literal notranslate"><span class="pre">False</span></code>, raises a ValueError instead.</p></li>
<li><p><strong>param</strong> – optional name of parameter to insert into error/warning messages.</p></li>
</ul>
</dd>
<dt class="field-even">Raises<span class="colon">:</span></dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>TypeError</strong> – <ul>
<li><p>if <code class="docutils literal notranslate"><span class="pre">use_defaults=False</span></code> and no rounds is specified</p></li>
<li><p>if rounds is not an integer.</p></li>
</ul>
</p></li>
<li><p><strong>ValueError</strong> – <ul>
<li><p>if rounds is <code class="docutils literal notranslate"><span class="pre">None</span></code> and class does not specify a value for
<a class="reference internal" href="#passlib.utils.handlers.HasRounds.default_rounds" title="passlib.utils.handlers.HasRounds.default_rounds"><code class="xref py py-attr docutils literal notranslate"><span class="pre">default_rounds</span></code></a>.</p></li>
<li><p>if <code class="docutils literal notranslate"><span class="pre">relaxed=False</span></code> and rounds is outside bounds of
<a class="reference internal" href="#passlib.utils.handlers.HasRounds.min_rounds" title="passlib.utils.handlers.HasRounds.min_rounds"><code class="xref py py-attr docutils literal notranslate"><span class="pre">min_rounds</span></code></a> and <a class="reference internal" href="#passlib.utils.handlers.HasRounds.max_rounds" title="passlib.utils.handlers.HasRounds.max_rounds"><code class="xref py py-attr docutils literal notranslate"><span class="pre">max_rounds</span></code></a> (if <code class="docutils literal notranslate"><span class="pre">relaxed=True</span></code>,
the rounds value will be clamped, and a warning issued).</p></li>
</ul>
</p></li>
</ul>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>normalized rounds value</p>
</dd>
</dl>
</dd></dl>

</section>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasManyIdents">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">HasManyIdents</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ident</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasManyIdents" title="Link to this definition">¶</a></dt>
<dd><p>mixin for hashes which use multiple prefix identifiers</p>
<p>For the hashes which may use multiple identifier prefixes,
this mixin adds an <code class="docutils literal notranslate"><span class="pre">ident</span></code> keyword to constructor.
Any value provided is passed through the <code class="xref py py-meth docutils literal notranslate"><span class="pre">norm_idents()</span></code> method,
which takes care of validating the identifier,
as well as allowing aliases for easier specification
of the identifiers by the user.</p>
<div class="admonition-todo admonition" id="id8">
<p class="admonition-title">Todo</p>
<p>document this class’s usage</p>
</div>
<section id="id9">
<h4>Class Methods<a class="headerlink" href="#id9" title="Link to this heading">¶</a></h4>
<div class="admonition-todo admonition" id="id10">
<p class="admonition-title">Todo</p>
<p>document using() and needs_update() options</p>
</div>
</section>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasManyBackends">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">HasManyBackends</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">checksum</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_defaults</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasManyBackends" title="Link to this definition">¶</a></dt>
<dd><p>GenericHandler mixin which provides selecting from multiple backends.</p>
<div class="admonition-todo admonition" id="id11">
<p class="admonition-title">Todo</p>
<p>finish documenting this class’s usage</p>
</div>
<p>For hashes which need to select from multiple backends,
depending on the host environment, this class
offers a way to specify alternate <code class="xref py py-meth docutils literal notranslate"><span class="pre">_calc_checksum()</span></code> methods,
and will dynamically chose the best one at runtime.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 1.7: </span>This class now derives from <code class="xref py py-class docutils literal notranslate"><span class="pre">BackendMixin</span></code>, which abstracts
out a more generic framework for supporting multiple backends.
The public api (<code class="xref py py-meth docutils literal notranslate"><span class="pre">get_backend()</span></code>, <code class="xref py py-meth docutils literal notranslate"><span class="pre">has_backend()</span></code>, <code class="xref py py-meth docutils literal notranslate"><span class="pre">set_backend()</span></code>)
is roughly the same.</p>
</div>
<section id="private-api-subclass-hooks">
<h4>Private API (Subclass Hooks)<a class="headerlink" href="#private-api-subclass-hooks" title="Link to this heading">¶</a></h4>
<p>As of version 1.7, classes should implement <code class="xref py py-meth docutils literal notranslate"><span class="pre">_load_backend_{name}()</span></code>, per
<code class="xref py py-class docutils literal notranslate"><span class="pre">BackendMixin</span></code>.  This hook should invoke <code class="xref py py-meth docutils literal notranslate"><span class="pre">_set_calc_checksum_backcend()</span></code>
to install it’s backend method.</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 1.7: </span>The following api is deprecated, and will be removed in Passlib 2.0:</p>
</div>
<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">_has_backend_{name}</span></span></dt>
<dd><p>private class attribute checked by <code class="xref py py-meth docutils literal notranslate"><span class="pre">has_backend()</span></code> to see if a
specific backend is available, it should be either <code class="docutils literal notranslate"><span class="pre">True</span></code>
or <code class="docutils literal notranslate"><span class="pre">False</span></code>. One of these should be provided by
the subclass for each backend listed in <code class="xref py py-attr docutils literal notranslate"><span class="pre">backends</span></code>.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">_calc_checksum_{name}</span></span></dt>
<dd><p>private class method that should implement <code class="xref py py-meth docutils literal notranslate"><span class="pre">_calc_checksum()</span></code>
for a given backend. it will only be called if the backend has
been selected by <code class="xref py py-meth docutils literal notranslate"><span class="pre">set_backend()</span></code>. One of these should be provided
by the subclass for each backend listed in <code class="xref py py-attr docutils literal notranslate"><span class="pre">backends</span></code>.</p>
</dd></dl>

</section>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRawSalt">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">HasRawSalt</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">salt</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasRawSalt" title="Link to this definition">¶</a></dt>
<dd><p>mixin for classes which use decoded salt parameter</p>
<p>A variant of <code class="xref py py-class docutils literal notranslate"><span class="pre">HasSalt</span></code> which takes in decoded bytes instead of an encoded string.</p>
<div class="admonition-todo admonition" id="id12">
<p class="admonition-title">Todo</p>
<p>document this class’s usage</p>
</div>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.HasRawChecksum">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">HasRawChecksum</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">checksum</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_defaults</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.HasRawChecksum" title="Link to this definition">¶</a></dt>
<dd><p>mixin for classes which work with decoded checksum bytes</p>
<div class="admonition-todo admonition" id="id13">
<p class="admonition-title">Todo</p>
<p>document this class’s usage</p>
</div>
</dd></dl>

</section>
<section id="examples">
<h3>Examples<a class="headerlink" href="#examples" title="Link to this heading">¶</a></h3>
<div class="admonition-todo admonition" id="id14">
<p class="admonition-title">Todo</p>
<p>Show some walk-through examples of how to use GenericHandler and its mixins</p>
</div>
</section>
</section>
<section id="the-statichandler-class">
<h2>The StaticHandler class<a class="headerlink" href="#the-statichandler-class" title="Link to this heading">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.StaticHandler">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">StaticHandler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">checksum</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_defaults</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwds</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.StaticHandler" title="Link to this definition">¶</a></dt>
<dd><p>GenericHandler mixin for classes which have no settings.</p>
<p>This mixin assumes the entirety of the hash ise stored in the
<code class="xref py py-attr docutils literal notranslate"><span class="pre">checksum</span></code> attribute; that the hash has no rounds, salt,
etc. This class provides the following:</p>
<ul class="simple">
<li><p>a default <code class="xref py py-meth docutils literal notranslate"><span class="pre">genconfig()</span></code> that always returns None.</p></li>
<li><p>a default <code class="xref py py-meth docutils literal notranslate"><span class="pre">from_string()</span></code> and <code class="xref py py-meth docutils literal notranslate"><span class="pre">to_string()</span></code>
that store the entire hash within <code class="xref py py-attr docutils literal notranslate"><span class="pre">checksum</span></code>,
after optionally stripping a constant prefix.</p></li>
</ul>
<p>All that is required by subclasses is an implementation of
the <code class="xref py py-meth docutils literal notranslate"><span class="pre">_calc_checksum()</span></code> method.</p>
</dd></dl>

<div class="admonition-todo admonition" id="id15">
<p class="admonition-title">Todo</p>
<p>Show some examples of how to use StaticHandler</p>
</div>
</section>
<section id="other-constructors">
<span id="index-1"></span><h2>Other Constructors<a class="headerlink" href="#other-constructors" title="Link to this heading">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.utils.handlers.PrefixWrapper">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">passlib.utils.handlers.</span></span><span class="sig-name descname"><span class="pre">PrefixWrapper</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wrapped</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">orig_prefix</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lazy</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ident</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.utils.handlers.PrefixWrapper" title="Link to this definition">¶</a></dt>
<dd><p>wraps another handler, adding a constant prefix.</p>
<p>instances of this class wrap another password hash handler,
altering the constant prefix that’s prepended to the wrapped
handlers’ hashes.</p>
<p>this is used mainly by the <a class="reference internal" href="passlib.hash.ldap_crypt.html"><span class="doc">ldap crypt</span></a> handlers;
such as <a class="reference internal" href="passlib.hash.ldap_crypt.html#passlib.hash.ldap_md5_crypt" title="passlib.hash.ldap_md5_crypt"><code class="xref py py-class docutils literal notranslate"><span class="pre">ldap_md5_crypt</span></code></a> which wraps <a class="reference internal" href="passlib.hash.md5_crypt.html#passlib.hash.md5_crypt" title="passlib.hash.md5_crypt"><code class="xref py py-class docutils literal notranslate"><span class="pre">md5_crypt</span></code></a> and adds a <code class="docutils literal notranslate"><span class="pre">{CRYPT}</span></code> prefix.</p>
<p>usage:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">myhandler</span> <span class="o">=</span> <span class="n">PrefixWrapper</span><span class="p">(</span><span class="s2">&quot;myhandler&quot;</span><span class="p">,</span> <span class="s2">&quot;md5_crypt&quot;</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="s2">&quot;$mh$&quot;</span><span class="p">,</span> <span class="n">orig_prefix</span><span class="o">=</span><span class="s2">&quot;$1$&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> – name to assign to handler</p></li>
<li><p><strong>wrapped</strong> – handler object or name of registered handler</p></li>
<li><p><strong>prefix</strong> – identifying prefix to prepend to all hashes</p></li>
<li><p><strong>orig_prefix</strong> – prefix to strip (defaults to ‘’).</p></li>
<li><p><strong>lazy</strong> – if True and wrapped handler is specified by name, don’t look it up until needed.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</section>
<section id="testing-hash-handlers">
<span id="id16"></span><h2>Testing Hash Handlers<a class="headerlink" href="#testing-hash-handlers" title="Link to this heading">¶</a></h2>
<p>Within its unittests, Passlib provides the <code class="xref py py-class docutils literal notranslate"><span class="pre">HandlerCase</span></code> class,
which can be subclassed to provide a unittest-compatible test class capable of
checking if a handler adheres to the <a class="reference internal" href="passlib.ifc.html#password-hash-api"><span class="std std-ref">PasswordHash API</span></a>.</p>
<section id="id17">
<h3>Usage<a class="headerlink" href="#id17" title="Link to this heading">¶</a></h3>
<p>As an example of how to use <code class="xref py py-class docutils literal notranslate"><span class="pre">HandlerCase</span></code>,
the following is an annotated version
of the unittest for <a class="reference internal" href="passlib.hash.des_crypt.html#passlib.hash.des_crypt" title="passlib.hash.des_crypt"><code class="xref py py-class docutils literal notranslate"><span class="pre">passlib.hash.des_crypt</span></code></a>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">passlib.hash</span> <span class="kn">import</span> <span class="n">des_crypt</span>
<span class="kn">from</span> <span class="nn">passlib.tests.utils</span> <span class="kn">import</span> <span class="n">HandlerCase</span>

<span class="c1"># create a subclass for the handler...</span>
<span class="k">class</span> <span class="nc">DesCryptTest</span><span class="p">(</span><span class="n">HandlerCase</span><span class="p">):</span>
    <span class="s2">&quot;test des-crypt algorithm&quot;</span>

    <span class="c1"># [required] - store the handler object itself in the handler attribute</span>
    <span class="n">handler</span> <span class="o">=</span> <span class="n">des_crypt</span>

    <span class="c1"># [required] - this should be a list of (password, hash) pairs,</span>
    <span class="c1">#              which should all verify correctly using your handler.</span>
    <span class="c1">#              it is recommend include pairs which test all of the following:</span>
    <span class="c1">#</span>
    <span class="c1">#              * empty string &amp; short strings for passwords</span>
    <span class="c1">#              * passwords with 2 byte unicode characters</span>
    <span class="c1">#              * hashes with varying salts, rounds, and other options</span>
    <span class="n">known_correct_hashes</span> <span class="o">=</span> <span class="p">(</span>
        <span class="c1"># format: (password, hash)</span>
        <span class="p">(</span><span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="s1">&#39;OgAwTx2l6NADI&#39;</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">,</span> <span class="s1">&#39;/Hk.VPuwQTXbc&#39;</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;test&#39;</span><span class="p">,</span> <span class="s1">&#39;N1tQbOFcM5fpg&#39;</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;Compl3X AlphaNu3meric&#39;</span><span class="p">,</span> <span class="s1">&#39;um.Wguz3eVCx2&#39;</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;4lpHa N|_|M3r1K W/ Cur5Es: #$%(*)(*%#&#39;</span><span class="p">,</span> <span class="s1">&#39;sNYqfOyauIyic&#39;</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;AlOtBsOl&#39;</span><span class="p">,</span> <span class="s1">&#39;cEpWz5IUCShqM&#39;</span><span class="p">),</span>
        <span class="p">(</span><span class="sa">u</span><span class="s1">&#39;hell</span><span class="se">\u00D6</span><span class="s1">&#39;</span><span class="p">,</span> <span class="s1">&#39;saykDgk3BPZ9E&#39;</span><span class="p">),</span>
        <span class="p">)</span>

    <span class="c1"># [optional] - if there are hashes which are similar in format</span>
    <span class="c1">#              to your handler, and you want to make sure :meth:`identify`</span>
    <span class="c1">#              does not return ``True`` for such hashes,</span>
    <span class="c1">#              list them here. otherwise this can be omitted.</span>
    <span class="c1">#</span>
    <span class="n">known_unidentified_hashes</span> <span class="o">=</span> <span class="p">[</span>
        <span class="c1"># bad char in otherwise correctly formatted hash</span>
        <span class="s1">&#39;!gAwTx2l6NADI&#39;</span><span class="p">,</span>
        <span class="p">]</span>
</pre></div>
</div>
</section>
<section id="id18">
<h3>Interface<a class="headerlink" href="#id18" title="Link to this heading">¶</a></h3>
</section>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="../contents.html">
              <img class="logo" src="../_static/masthead.png" alt="Logo of Passlib"/>
            </a></p>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<h3><a href="../contents.html">Table of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../narr/index.html">Walkthrough &amp; Tutorials</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">API Reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="passlib.apache.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.apache</span></code> - Apache Password Files</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.apps.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.apps</span></code> - Helpers for various applications</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.context.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.context</span></code> - CryptContext Hash Manager</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.crypto.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.crypto</span></code> - Cryptographic Helper Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.exc.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.exc</span></code> - Exceptions and warnings</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.ext.django.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.ext.django</span></code> - Django Password Hashing Plugin</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.hash.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.hash</span></code> - Password Hashing Schemes</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.hosts.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.hosts</span></code> - OS Password Handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.ifc.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.ifc</span></code> – Password Hash Interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.pwd.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.pwd</span></code> – Password generation helpers</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.registry.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.registry</span></code> - Password Handler Registry</a></li>
<li class="toctree-l2"><a class="reference internal" href="passlib.totp.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.totp</span></code> – TOTP / Two Factor Authentication</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="passlib.utils.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils</span></code> - Helper Functions</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="passlib.utils.html#constants">Constants</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.utils.html#unicode-helpers">Unicode Helpers</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.utils.html#bytes-helpers">Bytes Helpers</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.utils.html#encoding-helpers">Encoding Helpers</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.utils.html#randomness">Randomness</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.utils.html#interface-tests">Interface Tests</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="passlib.utils.html#submodules">Submodules</a><ul class="current">
<li class="toctree-l4 current"><a class="current reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.handlers</span></code> - Framework for writing password hashes</a></li>
<li class="toctree-l4"><a class="reference internal" href="passlib.utils.binary.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.binary</span></code> - Binary Helper Functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="passlib.utils.des.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.des</span></code> - DES routines [deprecated]</a></li>
<li class="toctree-l4"><a class="reference internal" href="passlib.utils.pbkdf2.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.pbkdf2</span></code> - PBKDF2 key derivation algorithm [deprecated]</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../other.html">Other Documentation</a></li>
</ul>

        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="passlib.utils.binary.html" title="passlib.utils.binary - Binary Helper Functions"
             >next</a> |</li>
        <li class="right" >
          <a href="passlib.utils.html" title="passlib.utils - Helper Functions"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../contents.html">Passlib latest Documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="index.html" >API Reference</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="passlib.utils.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils</span></code> - Helper Functions</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.handlers</span></code> - Framework for writing password hashes</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
    &#169; <a href="../copyright.html">Copyright</a> 2008-2025, Assurance Technologies, LLC. Last Updated 2025-12-21.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.2.3.
    </div>
  </body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit