| Total Complexity | 3 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 87.5% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class CoseHash |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string |
||
| 11 | */ |
||
| 12 | private $phpAlg; |
||
| 13 | |||
| 14 | private const MAP = [ |
||
| 15 | CoseAlgorithm::RS1 => 'sha1', |
||
| 16 | CoseAlgorithm::ES256 => 'sha256', |
||
| 17 | CoseAlgorithm::ES384 => 'sha384', |
||
| 18 | CoseAlgorithm::ES512 => 'sha512', |
||
| 19 | CoseAlgorithm::RS256 => 'sha256', |
||
| 20 | CoseAlgorithm::RS384 => 'sha384', |
||
| 21 | CoseAlgorithm::RS512 => 'sha512', |
||
| 22 | ]; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * CoseHash constructor. |
||
| 26 | * |
||
| 27 | * @param int $algorithm CoseAlgorithm identifier |
||
| 28 | * |
||
| 29 | * @see CoseAlgorithm |
||
| 30 | * |
||
| 31 | * @throws UnsupportedException |
||
| 32 | */ |
||
| 33 | 1 | public function __construct(int $algorithm) |
|
| 40 | 1 | } |
|
| 41 | |||
| 42 | 1 | public function hash(string $data): string |
|
| 47 |