1 | <?php |
||
16 | class SecurityHelper |
||
17 | { |
||
18 | /** |
||
19 | * @var Security |
||
20 | */ |
||
21 | protected $security; |
||
22 | |||
23 | 9 | public function __construct(Security $security) |
|
27 | |||
28 | /** |
||
29 | * Generates a secure hash from a password and a random salt. |
||
30 | * |
||
31 | * @param string $password |
||
32 | * @param null|int $cost |
||
33 | * |
||
34 | * @return string |
||
35 | */ |
||
36 | 3 | public function generatePasswordHash($password, $cost = null) |
|
40 | |||
41 | 5 | public function generateRandomString($length = 32) |
|
45 | |||
46 | 5 | public function validatePassword($password, $hash) |
|
50 | |||
51 | 1 | public function generatePassword($length) |
|
74 | } |
||
75 |