Debian Codegraph @

lib/3rdParty/composer/facile-it/php-openid-client/src/functions/derived_key.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Facile\OpenIDClient;
6
7 use Jose\Component\Core\JWK;
8
9 use function hash;
10 use function round;
11 use function substr;
12
13 function derived_key(string $secret, int $length): JWK
14 {
15 $hash = substr(hash('sha256', $secret, true), 0, (int) round($length / 8));
16
17 return new JWK([
18 'k' => base64url_encode($hash),
19 'kty' => 'oct',
20 ]);
21 }