Completed
Push — master ( ad7ee3...c08a34 )
by Rogier
29s queued 12s
created

DnsDigest::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Rogierw\RwAcme\Support;
4
5
class DnsDigest
6
{
7
    public static function createHash(string $token, string $thumbprint): string
8
    {
9
        return hash(
10
            'sha256',
11
            sprintf('%s.%s', $token, $thumbprint),
12
            true
13
        );
14
    }
15
16
    public static function make(string $token, string $thumbprint): string
17
    {
18
        return Base64::urlSafeEncode(self::createHash($token, $thumbprint));
19
    }
20
}
21