@@ -11,39 +11,39 @@ |
||
11 | 11 | */ |
12 | 12 | class PBKDF2 extends PasswordEncryptor_PHPHash |
13 | 13 | { |
14 | - /** |
|
15 | - * The number of internal iterations for hash_pbkdf2() to perform for the derivation. Please note that if you |
|
16 | - * change this from the default value you will break existing hashes stored in the database, so these would |
|
17 | - * need to be regenerated. |
|
18 | - * |
|
19 | - * @var int |
|
20 | - */ |
|
21 | - protected $iterations = 30000; |
|
14 | + /** |
|
15 | + * The number of internal iterations for hash_pbkdf2() to perform for the derivation. Please note that if you |
|
16 | + * change this from the default value you will break existing hashes stored in the database, so these would |
|
17 | + * need to be regenerated. |
|
18 | + * |
|
19 | + * @var int |
|
20 | + */ |
|
21 | + protected $iterations = 30000; |
|
22 | 22 | |
23 | - /** |
|
24 | - * @param string $algorithm |
|
25 | - * @param int|null $iterations |
|
26 | - * @throws Exception If the provided algorithm is not available in the current environment |
|
27 | - */ |
|
28 | - public function __construct(string $algorithm, int $iterations = null) |
|
29 | - { |
|
30 | - parent::__construct($algorithm); |
|
23 | + /** |
|
24 | + * @param string $algorithm |
|
25 | + * @param int|null $iterations |
|
26 | + * @throws Exception If the provided algorithm is not available in the current environment |
|
27 | + */ |
|
28 | + public function __construct(string $algorithm, int $iterations = null) |
|
29 | + { |
|
30 | + parent::__construct($algorithm); |
|
31 | 31 | |
32 | - if ($iterations !== null) { |
|
33 | - $this->iterations = $iterations; |
|
34 | - } |
|
35 | - } |
|
32 | + if ($iterations !== null) { |
|
33 | + $this->iterations = $iterations; |
|
34 | + } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return int |
|
39 | - */ |
|
40 | - public function getIterations(): int |
|
41 | - { |
|
42 | - return $this->iterations; |
|
43 | - } |
|
37 | + /** |
|
38 | + * @return int |
|
39 | + */ |
|
40 | + public function getIterations(): int |
|
41 | + { |
|
42 | + return $this->iterations; |
|
43 | + } |
|
44 | 44 | |
45 | - public function encrypt($password, $salt = null, $member = null) |
|
46 | - { |
|
47 | - return hash_pbkdf2($this->getAlgorithm(), (string) $password, (string) $salt, $this->getIterations()); |
|
48 | - } |
|
45 | + public function encrypt($password, $salt = null, $member = null) |
|
46 | + { |
|
47 | + return hash_pbkdf2($this->getAlgorithm(), (string) $password, (string) $salt, $this->getIterations()); |
|
48 | + } |
|
49 | 49 | } |