Total Complexity | 2 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
10 | abstract class HashFunc |
||
11 | { |
||
12 | /** |
||
13 | * Length of the produced hash in bytes. |
||
14 | * |
||
15 | * @var int |
||
16 | */ |
||
17 | protected $_length; |
||
18 | |||
19 | /** |
||
20 | * Functor interface. |
||
21 | * |
||
22 | * @param string $data |
||
23 | * |
||
24 | * @return string |
||
25 | */ |
||
26 | 13 | public function __invoke(string $data): string |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * Hash function. |
||
33 | * |
||
34 | * @param string $data |
||
35 | * |
||
36 | * @return string Hash result in raw format |
||
37 | */ |
||
38 | abstract public function hash(string $data): string; |
||
39 | |||
40 | /** |
||
41 | * Get hash length. |
||
42 | * |
||
43 | * @return int |
||
44 | */ |
||
45 | 14 | public function length(): int |
|
50 |