HMACPRF   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 2
dl 0
loc 16
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A compute() 0 3 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\PKCS5\PRF;
6
7
/**
8
 * Base class for HMAC based pseudorandom functions.
9
 */
10
abstract class HMACPRF extends PRF
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 10
    public function compute(string $arg1, string $arg2): string
16
    {
17 10
        return hash_hmac($this->_hashAlgo(), $arg2, $arg1, true);
18
    }
19
20
    /**
21
     * Get the name of the hash algorithm supported by hash_hmac.
22
     *
23
     * @return string
24
     */
25
    abstract protected function _hashAlgo(): string;
26
}
27