• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

azjezz / psl / 22639600900

03 Mar 2026 07:41PM UTC coverage: 98.092% (-0.1%) from 98.201%
22639600900

Pull #607

github

azjezz
ignore constants from coverage

Signed-off-by: azjezz <azjezz@protonmail.com>
Pull Request #607: feat: introduce `Crypto` component

352 of 369 new or added lines in 42 files covered. (95.39%)

9306 of 9487 relevant lines covered (98.09%)

39.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/Psl/Crypto/Hkdf/extract.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Psl\Crypto\Hkdf;
6

7
use Psl\Encoding\Hex;
8
use Psl\Hash\Hmac;
9
use SensitiveParameter;
10

11
use function str_repeat;
12

13
/**
14
 * HKDF-Extract: Extract a pseudorandom key from input keying material.
15
 *
16
 * @see https://tools.ietf.org/html/rfc5869#section-2.2
17
 *
18
 * @return non-empty-string
19
 */
20
function extract(
21
    #[SensitiveParameter] string $input_keying_material,
22
    string $salt = '',
23
    Hmac\Algorithm $algorithm = Hmac\Algorithm::Sha256,
24
): string {
25
    if ($salt === '') {
11✔
26
        /** @var non-negative-int $hashLength */
27
        $hashLength = match ($algorithm) {
2✔
28
            Hmac\Algorithm::Sha256 => 32,
2✔
NEW
29
            Hmac\Algorithm::Sha384 => 48,
×
NEW
30
            Hmac\Algorithm::Sha512 => 64,
×
NEW
31
            default => 32,
×
32
        };
2✔
33

34
        /** @var non-empty-string $salt */
35
        $salt = str_repeat("\x00", $hashLength);
2✔
36
    }
37

38
    /** @var non-empty-string */
39
    return Hex\decode(Hmac\hash($input_keying_material, $algorithm, $salt));
11✔
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc