Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

bcrypt_wcf2.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 1.54 KiB


 01  <?php
 02  /**
 03  *
 04  * This file is part of the phpBB Forum Software package.
 05  *
 06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07  * @license GNU General Public License, version 2 (GPL-2.0)
 08  *
 09  * For full copyright and license information, please see
 10  * the docs/CREDITS.txt file.
 11  *
 12  */
 13   
 14  namespace phpbb\passwords\driver;
 15   
 16  class bcrypt_wcf2 extends base
 17  {
 18      const PREFIX = '$wcf2$';
 19   
 20      /** @var \phpbb\passwords\driver\bcrypt */
 21      protected $bcrypt;
 22   
 23      /** @var \phpbb\passwords\driver\helper */
 24      protected $helper;
 25   
 26      /**
 27      * Constructor of passwords driver object
 28      *
 29      * @param \phpbb\passwords\driver\bcrypt $bcrypt Salted md5 driver
 30      * @param \phpbb\passwords\driver\helper $helper Password driver helper
 31      */
 32      public function __construct(\phpbb\passwords\driver\bcrypt $bcrypt, helper $helper)
 33      {
 34          $this->bcrypt = $bcrypt;
 35          $this->helper = $helper;
 36      }
 37   
 38      /**
 39      * {@inheritdoc}
 40      */
 41      public function get_prefix()
 42      {
 43          return self::PREFIX;
 44      }
 45   
 46      /**
 47      * {@inheritdoc}
 48      */
 49      public function is_legacy()
 50      {
 51          return true;
 52      }
 53   
 54      /**
 55      * {@inheritdoc}
 56      */
 57      public function hash($password, $user_row = '')
 58      {
 59          // Do not support hashing
 60          return false;
 61      }
 62   
 63      /**
 64      * {@inheritdoc}
 65      */
 66      public function check($password, $hash, $user_row = array())
 67      {
 68          if (empty($hash) || strlen($hash) != 60)
 69          {
 70              return false;
 71          }
 72          else
 73          {
 74              $salt = substr($hash, 0, 29);
 75   
 76              if (strlen($salt) != 29)
 77              {
 78                  return false;
 79              }
 80              // Works for standard WCF 2.x, i.e. WBB4 and similar
 81              return $this->helper->string_compare($hash, $this->bcrypt->hash($this->bcrypt->hash($password, $salt), $salt));
 82          }
 83      }
 84  }
 85