| 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 : |
<!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.hash.ldap_crypt - LDAP crypt() Wrappers — 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.hash.ldap_other - Non-Standard RFC2307 Hashes" href="passlib.hash.ldap_other.html" />
<link rel="prev" title="passlib.hash.ldap_digest - RFC2307 Standard Digests" href="passlib.hash.ldap_std.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.hash.ldap_other.html" title="passlib.hash.ldap_other - Non-Standard RFC2307 Hashes"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="passlib.hash.ldap_std.html" title="passlib.hash.ldap_digest - RFC2307 Standard Digests"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../contents.html">Passlib latest Documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="index.html" >API Reference</a> »</li>
<li class="nav-item nav-item-2"><a href="passlib.hash.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.hash</span></code> - Password Hashing Schemes</a> »</li>
<li class="nav-item nav-item-this"><a href=""><code class="samp docutils literal notranslate"><span class="pre">passlib.hash.ldap_</span><em><span class="pre">crypt</span></em></code> - LDAP crypt() Wrappers</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="passlib-hash-ldap-crypt-ldap-crypt-wrappers">
<h1><code class="samp docutils literal notranslate"><span class="pre">passlib.hash.ldap_</span><em><span class="pre">crypt</span></em></code> - LDAP crypt() Wrappers<a class="headerlink" href="#passlib-hash-ldap-crypt-ldap-crypt-wrappers" title="Link to this heading">¶</a></h1>
<p>Passlib provides support for all the standard
LDAP hash formats specified by <span class="target" id="index-0"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc2307.html"><strong>RFC 2307</strong></a>.
One of these, identified by RFC 2307 as the <code class="docutils literal notranslate"><span class="pre">{CRYPT}</span></code> scheme,
is somewhat different from the others.
Instead of specifying a password hashing scheme,
it’s supposed to wrap the host OS’s <code class="xref py py-func docutils literal notranslate"><span class="pre">crypt()</span></code>.
Being host-dependant, the actual hashes supported
by this scheme may differ greatly between host systems.
In order to provide uniform support across platforms,
Passlib defines a corresponding <code class="samp docutils literal notranslate"><span class="pre">ldap_</span><em><span class="pre">crypt-scheme</span></em></code> class
for each of the <a class="reference internal" href="passlib.hash.html#standard-unix-hashes"><span class="std std-ref">standard unix hashes</span></a>.
These classes all wrap the underlying implementations documented
elsewhere in Passlib, and can be used directly as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">passlib.hash</span> <span class="kn">import</span> <span class="n">ldap_md5_crypt</span>
<span class="gp">>>> </span><span class="c1"># hash password</span>
<span class="gp">>>> </span><span class="nb">hash</span> <span class="o">=</span> <span class="n">ldap_md5_crypt</span><span class="o">.</span><span class="n">hash</span><span class="p">(</span><span class="s2">"password"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">hash</span>
<span class="go">'{CRYPT}$1$gwvn5BO0$3dyk8j.UTcsNUPrLMsU6/0'</span>
<span class="gp">>>> </span><span class="c1"># verify password</span>
<span class="gp">>>> </span><span class="n">ldap_md5_crypt</span><span class="o">.</span><span class="n">verify</span><span class="p">(</span><span class="s2">"password"</span><span class="p">,</span> <span class="nb">hash</span><span class="p">)</span>
<span class="go">True</span>
<span class="gp">>>> </span><span class="n">ldap_md5_crypt</span><span class="o">.</span><span class="n">verify</span><span class="p">(</span><span class="s2">"secret"</span><span class="p">,</span> <span class="nb">hash</span><span class="p">)</span>
<span class="go">False</span>
<span class="gp">>>> </span><span class="c1"># determine if the underlying crypt() algorithm is supported</span>
<span class="gp">>>> </span><span class="c1"># by your host OS, or if the builtin Passlib implementation is being used.</span>
<span class="gp">>>> </span><span class="c1"># "os_crypt" - host supported; "builtin" - passlib version</span>
<span class="gp">>>> </span><span class="n">ldap_md5_crypt</span><span class="o">.</span><span class="n">get_backend</span><span class="p">()</span>
<span class="go">"os_crypt"</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<ul class="simple">
<li><p><a class="reference internal" href="../narr/hash-tutorial.html#password-hash-examples"><span class="std std-ref">password hash usage</span></a> – for more usage examples</p></li>
<li><p><a class="reference internal" href="passlib.hash.ldap_std.html"><span class="doc">ldap_{digest}</span></a> – for the other standard LDAP hashes.</p></li>
<li><p><a class="reference internal" href="passlib.apps.html#module-passlib.apps" title="passlib.apps: hashing & verifying passwords used in sql servers and other applications"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.apps</span></code></a> – for a list of <a class="reference internal" href="passlib.apps.html#ldap-contexts"><span class="std std-ref">premade ldap contexts</span></a>.</p></li>
</ul>
</div>
<section id="interface">
<h2>Interface<a class="headerlink" href="#interface" title="Link to this heading">¶</a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.hash.ldap_des_crypt">
<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.hash.</span></span><span class="sig-name descname"><span class="pre">ldap_des_crypt</span></span><a class="headerlink" href="#passlib.hash.ldap_des_crypt" title="Link to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.hash.ldap_bsdi_crypt">
<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.hash.</span></span><span class="sig-name descname"><span class="pre">ldap_bsdi_crypt</span></span><a class="headerlink" href="#passlib.hash.ldap_bsdi_crypt" title="Link to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.hash.ldap_md5_crypt">
<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.hash.</span></span><span class="sig-name descname"><span class="pre">ldap_md5_crypt</span></span><a class="headerlink" href="#passlib.hash.ldap_md5_crypt" title="Link to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.hash.ldap_bcrypt">
<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.hash.</span></span><span class="sig-name descname"><span class="pre">ldap_bcrypt</span></span><a class="headerlink" href="#passlib.hash.ldap_bcrypt" title="Link to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.hash.ldap_sha1_crypt">
<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.hash.</span></span><span class="sig-name descname"><span class="pre">ldap_sha1_crypt</span></span><a class="headerlink" href="#passlib.hash.ldap_sha1_crypt" title="Link to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.hash.ldap_sha256_crypt">
<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.hash.</span></span><span class="sig-name descname"><span class="pre">ldap_sha256_crypt</span></span><a class="headerlink" href="#passlib.hash.ldap_sha256_crypt" title="Link to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="passlib.hash.ldap_sha512_crypt">
<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.hash.</span></span><span class="sig-name descname"><span class="pre">ldap_sha512_crypt</span></span><a class="headerlink" href="#passlib.hash.ldap_sha512_crypt" title="Link to this definition">¶</a></dt>
<dd><p>All of these classes have the same interface as their corresponding
underlying hash (e.g. <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">des_crypt</span></code></a>, <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>, etc).</p>
</dd></dl>
<p class="rubric">Footnotes</p>
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="pwd" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></span>
<p>The manpage for <strong class="command">slappasswd</strong> - <a class="reference external" href="http://gd.tuwien.ac.at/linuxcommand.org/man_pages/slappasswd8.html">http://gd.tuwien.ac.at/linuxcommand.org/man_pages/slappasswd8.html</a>.</p>
</aside>
<aside class="footnote brackets" id="rfc" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span>2<span class="fn-bracket">]</span></span>
<p>The basic format for these hashes is laid out in RFC 2307 - <a class="reference external" href="http://www.ietf.org/rfc/rfc2307.txt">http://www.ietf.org/rfc/rfc2307.txt</a></p>
</aside>
</aside>
</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 & 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 current"><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><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="passlib.hash.html#overview">Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.hash.html#unix-hashes">Unix Hashes</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.hash.html#other-modular-crypt-hashes">Other “Modular Crypt” Hashes</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="passlib.hash.html#ldap-rfc2307-hashes">LDAP / RFC2307 Hashes</a><ul class="current">
<li class="toctree-l4 current"><a class="reference internal" href="passlib.hash.html#standard-ldap-schemes">Standard LDAP Schemes</a></li>
<li class="toctree-l4"><a class="reference internal" href="passlib.hash.html#non-standard-ldap-schemes">Non-Standard LDAP Schemes</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="passlib.hash.html#sql-database-hashes">SQL Database Hashes</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.hash.html#ms-windows-hashes">MS Windows Hashes</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.hash.html#cisco-hashes">Cisco Hashes</a></li>
<li class="toctree-l3"><a class="reference internal" href="passlib.hash.html#other-hashes">Other Hashes</a></li>
</ul>
</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"><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></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.hash.ldap_other.html" title="passlib.hash.ldap_other - Non-Standard RFC2307 Hashes"
>next</a> |</li>
<li class="right" >
<a href="passlib.hash.ldap_std.html" title="passlib.hash.ldap_digest - RFC2307 Standard Digests"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../contents.html">Passlib latest Documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="index.html" >API Reference</a> »</li>
<li class="nav-item nav-item-2"><a 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="nav-item nav-item-this"><a href=""><code class="samp docutils literal notranslate"><span class="pre">passlib.hash.ldap_</span><em><span class="pre">crypt</span></em></code> - LDAP crypt() Wrappers</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
© <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>