Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 4272

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Generates a key</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mhash-get-hash-name.html">mhash_get_hash_name</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mhash.html">mhash</a></div>
 <div class="up"><a href="ref.mhash.html">Mhash Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.mhash-keygen-s2k" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mhash_keygen_s2k</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5)</p><p class="refpurpose"><span class="refname">mhash_keygen_s2k</span> &mdash; <span class="dc-title">Generates a key</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.mhash-keygen-s2k-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>mhash_keygen_s2k</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$hash</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$password</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$salt</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$bytes</code></span>
   )</div>

  <p class="para rdfs-comment">
   Generates a key according to the given <em><code class="parameter">hash</code></em>, using an user
   provided <em><code class="parameter">password</code></em>.
  </p>
  <p class="para">
   This is the Salted S2K algorithm as specified in the OpenPGP
   document (<a href="http://www.faqs.org/rfcs/rfc2440" class="link external">&raquo;&nbsp;RFC 2440</a>).
  </p>
  <p class="para">
   Keep in mind that user supplied passwords are not really suitable
   to be used as keys in cryptographic algorithms, since users normally
   choose keys they can write on keyboard. These passwords use
   only 6 to 7 bits per character (or less). It is highly recommended
   to use some kind of transformation (like this function) to the user
   supplied key.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mhash-keygen-s2k-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">hash</code></em></span>
     <dd>

      <p class="para">
       The hash ID used to create the key.
       One of the <strong><code>MHASH_hashname</code></strong> constants.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">password</code></em></span>
     <dd>

      <p class="para">
       An user supplied password.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">salt</code></em></span>
     <dd>

      <p class="para">
       Must be different and random enough for every key you generate in
       order to create different keys. Because <em><code class="parameter">salt</code></em>
       must be known when you check the keys, it is a good idea to append
       the key to it. Salt has a fixed length of 8 bytes and will be padded
       with zeros if you supply less bytes.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">bytes</code></em></span>
     <dd>

      <p class="para">
       The key length, in bytes.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mhash-keygen-s2k-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the generated key as a string, or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mhash-get-hash-name.html">mhash_get_hash_name</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mhash.html">mhash</a></div>
 <div class="up"><a href="ref.mhash.html">Mhash Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>