1 | <?php |
||
29 | abstract class Password |
||
30 | { |
||
31 | /** |
||
32 | * Hash a string with an algorithm |
||
33 | * |
||
34 | * @param string $string Raw string |
||
35 | * @param integer $cost Cost between 4 and 31, higher = better but slower |
||
36 | * |
||
37 | * @return string |
||
38 | **/ |
||
|
|||
39 | |||
40 | public static function hash($string, $cost = 10) |
||
61 | |||
62 | /** |
||
63 | * Compare a string with a given password |
||
64 | * |
||
65 | * @param string $string Raw string |
||
66 | * @param string $hash Hashed password to compare with |
||
67 | * |
||
68 | * @return boolean |
||
69 | **/ |
||
70 | |||
71 | public static function compare($string, $hash) |
||
81 | } |
||
82 |