| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 7 | class PasswordEncryptor_PBKDF2 extends PasswordEncryptor_PHPHash |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * The number of internal iterations for hash_pbkdf2() to perform for the derivation. Please note that if you |
||
| 11 | * change this from the default value you will break existing hashes stored in the database, so these would |
||
| 12 | * need to be regenerated. |
||
| 13 | * |
||
| 14 | * @var int |
||
| 15 | */ |
||
| 16 | protected $iterations = 10000; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string $algorithm |
||
| 20 | * @param int|null $iterations |
||
| 21 | * @throws Exception If the provided algorithm is not available in the current environment |
||
| 22 | */ |
||
| 23 | public function __construct(string $algorithm, int $iterations = null) |
||
| 24 | { |
||
| 25 | parent::__construct($algorithm); |
||
| 26 | |||
| 27 | if ($iterations !== null) { |
||
| 28 | $this->iterations = $iterations; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return int |
||
| 34 | */ |
||
| 35 | public function getIterations(): int |
||
| 38 | } |
||
| 39 | |||
| 40 | public function encrypt($password, $salt = null, $member = null) |
||
| 45 |