| 1 | <?php |
||
| 9 | class Password implements PasswordInterface |
||
| 10 | { |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Verify Password hash. |
||
| 14 | * |
||
| 15 | * @param string $password |
||
| 16 | * @param string $hash |
||
| 17 | * @return bool |
||
| 18 | * @throws \Exception |
||
| 19 | */ |
||
| 20 | 23 | public function verify($password, $hash) |
|
| 27 | |||
| 28 | /** |
||
| 29 | * Check if provided password needs rehashing with new Algorithm. |
||
| 30 | * |
||
| 31 | * @param string $password |
||
| 32 | * @param string $hash |
||
| 33 | * @param int $algo |
||
| 34 | * @param int $cost |
||
| 35 | * @return bool|string |
||
| 36 | */ |
||
| 37 | 2 | public function needsRehash($password, $hash, $algo = PASSWORD_DEFAULT, $cost = 12) |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Create hash from string. |
||
| 47 | * |
||
| 48 | * @param string $password |
||
| 49 | * @param int $algo |
||
| 50 | * @param int $cost |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | 8 | public function hash($password, $algo = PASSWORD_DEFAULT, $cost = 12) |
|
| 57 | } |
||
| 58 |