Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * Pop PHP Framework (https://www.popphp.org/) |
| 4 | * |
| 5 | * @link https://github.com/popphp/popphp-framework |
| 6 | * @author Nick Sagona, III <dev@noladev.com> |
| 7 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 8 | * @license https://www.popphp.org/license New BSD License |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * @namespace |
| 13 | */ |
| 14 | namespace Pop\Crypt\Hashing; |
| 15 | |
| 16 | /** |
| 17 | * Pop Crypt hashing interface |
| 18 | * |
| 19 | * @category Pop |
| 20 | * @package Pop\Crypt |
| 21 | * @author Nick Sagona, III <dev@noladev.com> |
| 22 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 23 | * @license https://www.popphp.org/license New BSD License |
| 24 | * @version 3.0.0 |
| 25 | */ |
| 26 | interface HasherInterface |
| 27 | { |
| 28 | |
| 29 | /** |
| 30 | * Make hashed value (based on the hasher class) |
| 31 | * |
| 32 | * @param string $value |
| 33 | * @return string |
| 34 | */ |
| 35 | public function make(#[\SensitiveParameter] string $value): string; |
| 36 | |
| 37 | /** |
| 38 | * Determine if the hashed value requires re-hashing (based on the hasher class) |
| 39 | * |
| 40 | * @param string $hashedValue |
| 41 | * @return bool |
| 42 | */ |
| 43 | public function requiresRehash(string $hashedValue): bool; |
| 44 | |
| 45 | /** |
| 46 | * Set hasher options |
| 47 | * |
| 48 | * @param array $options |
| 49 | * @return static |
| 50 | */ |
| 51 | public function setOptions(array $options): static; |
| 52 | |
| 53 | /** |
| 54 | * Create hasher object with options |
| 55 | * |
| 56 | * @return static |
| 57 | */ |
| 58 | public static function create(array $options = []): static; |
| 59 | |
| 60 | /** |
| 61 | * Create hashed value |
| 62 | * |
| 63 | * @param string $value |
| 64 | * @param string|int|null $algorithm |
| 65 | * @param array $options |
| 66 | * @return string |
| 67 | */ |
| 68 | public function createHash(#[\SensitiveParameter] string $value, string|int|null $algorithm, array $options = []): string; |
| 69 | |
| 70 | /** |
| 71 | * Get info from hashed value |
| 72 | * |
| 73 | * @param string $hashedValue |
| 74 | * @return array |
| 75 | */ |
| 76 | public function getInfo(string $hashedValue): array; |
| 77 | |
| 78 | /** |
| 79 | * Get available hashing algorithms |
| 80 | * |
| 81 | * @return array |
| 82 | */ |
| 83 | public function getAlgorithms(): array; |
| 84 | |
| 85 | /** |
| 86 | * Determine if the hashed value needs to be re-hashed |
| 87 | * |
| 88 | * @param string $hashedValue |
| 89 | * @param string|int|null $algorithm |
| 90 | * @param array $options |
| 91 | * @return bool |
| 92 | */ |
| 93 | public function needsRehash(string $hashedValue, string|int|null $algorithm, array $options = []): bool; |
| 94 | |
| 95 | /** |
| 96 | * Verify hash |
| 97 | * |
| 98 | * @param string $value |
| 99 | * @param string $hashedValue |
| 100 | * @return bool |
| 101 | */ |
| 102 | public function verify(#[\SensitiveParameter] string $value, string $hashedValue): bool; |
| 103 | |
| 104 | } |