Commit | Line | Data |
---|---|---|
14d4f286 S |
1 | <?php |
2 | /** | |
3 | * The core password hash interface | |
4 | * | |
5 | * All pasword implementations must implement this interface | |
6 | * | |
7 | * PHP version 5.3 | |
8 | * | |
9 | * @category PHPCryptLib | |
10 | * @package Password | |
11 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
12 | * @copyright 2011 The Authors | |
13 | * @license http://www.opensource.org/licenses/mit-license.html MIT License | |
14 | * @version Build @@version@@ | |
15 | */ | |
16 | ||
17 | namespace CryptLib\Password; | |
18 | ||
19 | /** | |
20 | * The core password key interface | |
21 | * | |
22 | * All pasword implementations must implement this interface | |
23 | * | |
24 | * @category PHPCryptLib | |
25 | * @package Password | |
26 | * @author Anthony Ferrara <ircmaxell@ircmaxell.com> | |
27 | * @codeCoverageIgnore | |
28 | */ | |
29 | interface Password { | |
30 | ||
31 | /** | |
32 | * Determine if the hash was made with this method | |
33 | * | |
34 | * @param string $hash The hashed data to check | |
35 | * | |
36 | * @return boolean Was the hash created by this method | |
37 | */ | |
38 | public static function detect($hash); | |
39 | ||
40 | /** | |
41 | * Return the prefix used by this hashing method | |
42 | * | |
43 | * @return string The prefix used | |
44 | */ | |
45 | public static function getPrefix(); | |
46 | ||
47 | /** | |
48 | * Load an instance of the class based upon the supplied hash | |
49 | * | |
50 | * @param string $hash The hash to load from | |
51 | * | |
52 | * @return Password the created instance | |
53 | */ | |
54 | public static function loadFromHash($hash); | |
55 | ||
56 | /** | |
57 | * Create a password hash for a given plain text password | |
58 | * | |
59 | * @param string $password The password to hash | |
60 | * | |
61 | * @return string The formatted password hash | |
62 | */ | |
63 | public function create($password); | |
64 | ||
65 | /** | |
66 | * Verify a password hash against a given plain text password | |
67 | * | |
68 | * @param string $password The password to hash | |
69 | * @param string $hash The supplied ahsh to validate | |
70 | * | |
71 | * @return boolean Does the password validate against the hash | |
72 | */ | |
73 | public function verify($password, $hash); | |
74 | ||
75 | } |