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

DnsDigest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 6
c 1
b 0
f 1
dl 0
loc 14
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 3 1
A createHash() 0 6 1
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