1 | <?php |
||
9 | class Password implements PasswordInterface |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * Hash the password using the specified algorithm |
||
14 | * |
||
15 | * @param string $password The password to hash |
||
16 | * @param int $algorithm The algorithm to use (Defined by PASSWORD_* constants) |
||
17 | * @param array $options The options for the algorithm to use |
||
18 | * @return string|bool |
||
19 | */ |
||
20 | public function make(string $password, int $algorithm = PASSWORD_DEFAULT, array $options = []) |
||
24 | |||
25 | /** |
||
26 | * Get information about the password hash. Returns an array of the information |
||
27 | * that was used to generate the password hash. |
||
28 | * |
||
29 | * @param string $hash |
||
30 | * @return array |
||
31 | */ |
||
32 | public function info(string $hash): array |
||
36 | |||
37 | /** |
||
38 | * Determine if the password hash needs to be rehashed according to the options provided. |
||
39 | * If the answer is true, after validating the password using password_verify, rehash it. |
||
40 | * |
||
41 | * @param string $hash The hash to test |
||
42 | * @param int $alg The algorithm used for new password hashes |
||
43 | * @param array $options The options array passed to password_hash |
||
44 | * @return bool |
||
45 | */ |
||
46 | public function rehash($hash, $alg = PASSWORD_DEFAULT, array $options = []): bool |
||
50 | |||
51 | /** |
||
52 | * Verify a password against a hash using a timing attack resistant approach |
||
53 | * |
||
54 | * @param string $password The password to verify |
||
55 | * @param string $hash The hash to verify against |
||
56 | * @return bool |
||
57 | */ |
||
58 | public function verify($password, $hash): bool |
||
62 | |||
63 | } |
||
64 |