Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
12 | class PBKDF2 extends PasswordEncryptor_PHPHash |
||
13 | { |
||
14 | /** |
||
15 | * The number of internal iterations for hash_pbkdf2() to perform for the derivation. |
||
16 | * |
||
17 | * @var int |
||
18 | */ |
||
19 | protected $iterations = 10000; |
||
20 | |||
21 | /** |
||
22 | * @param string $algorithm |
||
23 | * @param int|null $iterations |
||
24 | * @throws Exception If the provided algorithm is not available in the current environment |
||
25 | */ |
||
26 | public function __construct(string $algorithm, int $iterations = null) |
||
27 | { |
||
28 | parent::__construct($algorithm); |
||
29 | |||
30 | if ($iterations !== null) { |
||
31 | $this->iterations = $iterations; |
||
32 | } |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return int |
||
37 | */ |
||
38 | public function getIterations(): int |
||
39 | { |
||
40 | return $this->iterations; |
||
41 | } |
||
42 | |||
43 | public function encrypt($password, $salt = null, $member = null) |
||
46 | } |
||
47 | } |
||
48 |