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.crypto.des.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.crypto.des - DES routines &#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.exc - Exceptions and warnings" href="passlib.exc.html" />
    <link rel="prev" title="passlib.crypto.digest - Hash &amp; Related Helpers" href="passlib.crypto.digest.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.exc.html" title="passlib.exc - Exceptions and warnings"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="passlib.crypto.digest.html" title="passlib.crypto.digest - Hash &amp; Related Helpers"
             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.crypto.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.crypto</span></code> - Cryptographic 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.crypto.des</span></code> - DES routines</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="module-passlib.crypto.des">
<span id="passlib-crypto-des-des-routines"></span><h1><a class="reference internal" href="#module-passlib.crypto.des" title="passlib.crypto.des: routines for performing DES encryption"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.crypto.des</span></code></a> - DES routines<a class="headerlink" href="#module-passlib.crypto.des" title="Link to this heading">¶</a></h1>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 1.7: </span>This module was relocated from <code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.utils.des</span></code>;
the old location will be removed in Passlib 2.0.</p>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>NIST has declared DES to be “inadequate” for cryptographic purposes.
These routines, and the password hashes based on them,
should not be used in new applications.</p>
</div>
<p>This module contains routines for encrypting blocks of data using the DES algorithm.
Note that these functions do not support multi-block operation or decryption,
since they are designed primarily for use in password hash algorithms
(such as <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> and <a class="reference internal" href="passlib.hash.bsdi_crypt.html#passlib.hash.bsdi_crypt" title="passlib.hash.bsdi_crypt"><code class="xref py py-class docutils literal notranslate"><span class="pre">bsdi_crypt</span></code></a>).</p>
<dl class="py function">
<dt class="sig sig-object py" id="passlib.crypto.des.expand_des_key">
<span class="sig-prename descclassname"><span class="pre">passlib.crypto.des.</span></span><span class="sig-name descname"><span class="pre">expand_des_key</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.crypto.des.expand_des_key" title="Link to this definition">¶</a></dt>
<dd><p>convert DES from 7 bytes to 8 bytes (by inserting empty parity bits)</p>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="passlib.crypto.des.des_encrypt_block">
<span class="sig-prename descclassname"><span class="pre">passlib.crypto.des.</span></span><span class="sig-name descname"><span class="pre">des_encrypt_block</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">input</span></span></em>, <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">0</span></span></em>, <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">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.crypto.des.des_encrypt_block" title="Link to this definition">¶</a></dt>
<dd><p>encrypt single block of data using DES, operates on 8-byte strings.</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>key</strong> – DES key as 7 byte string, or 8 byte string with parity bits
(parity bit values are ignored).</p></li>
<li><p><strong>input</strong> – plaintext block to encrypt, as 8 byte string.</p></li>
<li><p><strong>salt</strong> – Optional 24-bit integer used to mutate the base DES algorithm in a
manner specific to <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> and its variants.
The default value <code class="docutils literal notranslate"><span class="pre">0</span></code> provides the normal (unsalted) DES behavior.
The salt functions as follows:
if the <code class="docutils literal notranslate"><span class="pre">i</span></code>’th bit of <code class="docutils literal notranslate"><span class="pre">salt</span></code> is set,
bits <code class="docutils literal notranslate"><span class="pre">i</span></code> and <code class="docutils literal notranslate"><span class="pre">i+24</span></code> are swapped in the DES E-box output.</p></li>
<li><p><strong>rounds</strong> – Optional number of rounds of to apply the DES key schedule.
the default (<code class="docutils literal notranslate"><span class="pre">rounds=1</span></code>) provides the normal DES behavior,
but <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> and its variants use
alternate rounds values.</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> – if any of the provided args are of the wrong type.</p></li>
<li><p><strong>ValueError</strong> – if any of the input blocks are the wrong size,
or the salt/rounds values are out of range.</p></li>
</ul>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>resulting 8-byte ciphertext block.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="passlib.crypto.des.des_encrypt_int_block">
<span class="sig-prename descclassname"><span class="pre">passlib.crypto.des.</span></span><span class="sig-name descname"><span class="pre">des_encrypt_int_block</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">key</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">input</span></span></em>, <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">0</span></span></em>, <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">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#passlib.crypto.des.des_encrypt_int_block" title="Link to this definition">¶</a></dt>
<dd><p>encrypt single block of data using DES, operates on 64-bit integers.</p>
<p>this function is essentially the same as <a class="reference internal" href="#passlib.crypto.des.des_encrypt_block" title="passlib.crypto.des.des_encrypt_block"><code class="xref py py-func docutils literal notranslate"><span class="pre">des_encrypt_block()</span></code></a>,
except that it operates on integers, and will NOT automatically
expand 56-bit keys if provided (since there’s no way to detect them).</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>key</strong> – DES key as 64-bit integer (the parity bits are ignored).</p></li>
<li><p><strong>input</strong> – input block as 64-bit integer</p></li>
<li><p><strong>salt</strong> – optional 24-bit integer used to mutate the base DES algorithm.
defaults to <code class="docutils literal notranslate"><span class="pre">0</span></code> (no mutation applied).</p></li>
<li><p><strong>rounds</strong> – optional number of rounds of to apply the DES key schedule.
defaults to <code class="docutils literal notranslate"><span class="pre">1</span></code>.</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> – if any of the provided args are of the wrong type.</p></li>
<li><p><strong>ValueError</strong> – if any of the input blocks are the wrong size,
or the salt/rounds values are out of range.</p></li>
</ul>
</dd>
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>resulting ciphertext as 64-bit integer.</p>
</dd>
</dl>
</dd></dl>

</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 current"><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><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="passlib.crypto.digest.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.crypto.digest</span></code> - Hash &amp; Related Helpers</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.crypto.des</span></code> - DES routines</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#passlib.crypto.des.expand_des_key"><code class="docutils literal notranslate"><span class="pre">expand_des_key()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#passlib.crypto.des.des_encrypt_block"><code class="docutils literal notranslate"><span class="pre">des_encrypt_block()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#passlib.crypto.des.des_encrypt_int_block"><code class="docutils literal notranslate"><span class="pre">des_encrypt_int_block()</span></code></a></li>
</ul>
</li>
</ul>
</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"><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.exc.html" title="passlib.exc - Exceptions and warnings"
             >next</a> |</li>
        <li class="right" >
          <a href="passlib.crypto.digest.html" title="passlib.crypto.digest - Hash &amp; Related Helpers"
             >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.crypto.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">passlib.crypto</span></code> - Cryptographic 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.crypto.des</span></code> - DES routines</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