| 1 | <?php |
||
| 11 | class PasswordHasher |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var int |
||
| 15 | */ |
||
| 16 | private $cost; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @Inject("%application.passwordHasher.cost%") |
||
| 20 | * @param int $cost |
||
| 21 | */ |
||
| 22 | 3 | public function __construct(int $cost) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $password |
||
| 29 | * @return string $hash |
||
| 30 | */ |
||
| 31 | 1 | public function generateHash(string $password) : string |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @param string $password |
||
| 40 | * @param string $hash |
||
| 41 | * @return bool |
||
| 42 | */ |
||
| 43 | 1 | public function verifyHash(string $password, string $hash) : bool |
|
| 47 | } |
||
| 48 |