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