[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/passwords/driver/ -> base_native.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\passwords\driver;
  15  
  16  abstract class base_native extends base
  17  {
  18      /**
  19      * Return the constant name for this driver's algorithm
  20      *
  21      * @link https://www.php.net/manual/en/password.constants.php
  22      *
  23      * @return string
  24      */
  25      abstract public function get_algo_name();
  26  
  27      /**
  28      * Return the options set for this driver instance
  29      *
  30      * @return array
  31      */
  32      abstract public function get_options();
  33  
  34      /**
  35      * {@inheritdoc}
  36      */
  37  	public function check($password, $hash, $user_row = [])
  38      {
  39          return password_verify($password, $hash);
  40      }
  41  
  42      /**
  43      * Return the value for this driver's algorithm
  44      *
  45      * @return integer
  46      */
  47  	public function get_algo_value()
  48      {
  49          return constant($this->get_algo_name());
  50      }
  51  
  52      /**
  53      * {@inheritdoc}
  54      */
  55  	public function hash($password)
  56      {
  57          return password_hash($password, $this->get_algo_value(), $this->get_options());
  58      }
  59  
  60      /**
  61      * {@inheritdoc}
  62      */
  63  	public function is_supported()
  64      {
  65          return defined($this->get_algo_name()) && function_exists('password_hash') && function_exists('password_needs_rehash') && function_exists('password_verify');
  66      }
  67  
  68      /**
  69      * {@inheritdoc}
  70      */
  71  	public function needs_rehash($hash)
  72      {
  73          return password_needs_rehash($hash, $this->get_algo_value(), $this->get_options());
  74      }
  75  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1