<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.password.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.password-verify.php',
    1 => 'password_verify',
    2 => '&Uuml;berpr&uuml;ft, ob ein Passwort und ein Hash zusammenpassen',
  ),
  'up' => 
  array (
    0 => 'ref.password.php',
    1 => 'Passwort-Hashing-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.password-needs-rehash.php',
    1 => 'password_needs_rehash',
  ),
  'next' => 
  array (
    0 => 'book.rnp.php',
    1 => 'Rnp',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/password/functions/password-verify.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.password-verify" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">password_verify</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.5.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">password_verify</span> &mdash; <span class="dc-title">Überprüft, ob ein Passwort und ein Hash zusammenpassen</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.password-verify-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>password_verify</strong></span>(<span class="methodparam"><span class="attribute"><a href="class.sensitiveparameter.php">#[\SensitiveParameter]</a> </span><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$password</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$hash</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Überprüft, ob ein Passwort und ein Hash zusammenpassen.
   <span class="function"><strong>password_verify()</strong></span> ist kompatibel zu
   <span class="function"><a href="function.crypt.php" class="function">crypt()</a></span>. Daher können Passwort-Hashes, die mit
   <span class="function"><a href="function.crypt.php" class="function">crypt()</a></span> erzeugt wurden, mit
   <span class="function"><strong>password_verify()</strong></span> verwendet werden.
  </p>
  <p class="para">
   Es ist zu beachten, dass <span class="function"><a href="function.password-hash.php" class="function">password_hash()</a></span> den
   Algorithmus, den Aufwand und den Salt als Teil des Hashes zurückgibt. Somit
   sind in Hash alle Informationen enthalten, die für die Überprüfung des
   Hashes erforderlich sind. Dies erlaubt es der Funktion, den Hash zu prüfen,
   ohne dass Informationen über den Salt oder den Algorithmus an anderer
   Stelle gespeichert werden müssen.
  </p>
  <p class="para">
   Diese Funktion ist vor Timing-Angriffen sicher.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.password-verify-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">password</code></dt>
    <dd>
     <p class="para">
      Das Passwort des Benutzers.
     </p>
    </dd>
   
   
    <dt><code class="parameter">hash</code></dt>
    <dd>
     <p class="para">
      Ein Hash, der durch <span class="function"><a href="function.password-hash.php" class="function">password_hash()</a></span> erzeugt wurde.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.password-verify-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück, falls Passwort und Hash zusammenpassen, sonst <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.password-verify-examples">
  <h3 class="title">Beispiele</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Beispiel #1 <span class="function"><strong>password_verify()</strong></span>-Beispiel</strong></p>
    <div class="example-contents"><p>
     Dies ist ein vereinfachtes Beispiel; es wird empfohlen, ein korrektes
     Passwort bei Bedarf noch einmal zu hashen; siehe
     <span class="function"><a href="function.password-needs-rehash.php" class="function">password_needs_rehash()</a></span> für ein Beispiel.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// Siehe auch das password_hash()-Beispiel in diesem Kontext<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= </span><span style="color: #DD0000">'$2y$12$4Umg0rCJwMswRw/l.SwHvuQV01coP0eWmGzd61QH2RvAOMANUBGC.'</span><span style="color: #007700">;<br /><br />if (</span><span style="color: #0000BB">password_verify</span><span style="color: #007700">(</span><span style="color: #DD0000">'rasmuslerdorf'</span><span style="color: #007700">, </span><span style="color: #0000BB">$hash</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">'Valides Passwort!'</span><span style="color: #007700">;<br />} else {<br />    echo </span><span style="color: #DD0000">'Invalides Passwort.'</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Valides Passwort!</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.password-verify-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.password-needs-rehash.php" class="function" rel="rdfs-seeAlso">password_needs_rehash()</a> - &Uuml;berpr&uuml;ft, ob der &uuml;bergebene Hash mit den &uuml;bergebenen Optionen &uuml;bereinstimmt</span></li>
    <li><span class="function"><a href="function.password-hash.php" class="function" rel="rdfs-seeAlso">password_hash()</a> - Erstellt einen Passwort-Hash</span></li>
    <li><span class="function"><a href="function.sodium-crypto-pwhash-str-verify.php" class="function" rel="rdfs-seeAlso">sodium_crypto_pwhash_str_verify()</a> - Verifies that a password matches a hash</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>