1 | <?php |
||
13 | class PhpPassword implements IPassword { |
||
14 | /** |
||
15 | * @var int One of the `PASSWORD_*` constants supplied to {@link password_hash()}. |
||
16 | */ |
||
17 | protected $algorithm; |
||
18 | |||
19 | /** |
||
20 | * Initialize an instance of this class. |
||
21 | * |
||
22 | * @param int $algorithm The crypt password to use when hashing passwords. |
||
23 | */ |
||
24 | public function __construct($algorithm = PASSWORD_DEFAULT) { |
||
27 | |||
28 | |||
29 | /** |
||
30 | * Hashes a plaintext password. |
||
31 | * |
||
32 | * @param string $password The password to hash. |
||
33 | * @return string Returns the hashed password. |
||
34 | */ |
||
35 | public function hash($password) { |
||
38 | |||
39 | /** |
||
40 | * Checks if a given password hash needs to be re-hashed to to a stronger algorithm. |
||
41 | * |
||
42 | * @param string $hash The hash to check. |
||
43 | * @return bool Returns `true` |
||
44 | */ |
||
45 | public function needsRehash($hash) { |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function verify($password, $hash) { |
||
58 | } |
||
59 |