HMACPRF::compute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 2
crap 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