MacGenerator::generateFromString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace BWC\Share\Payment;
4
5
class MacGenerator
6
{
7
    /**
8
     * @param string $string
9
     * @param string $key
10
     * @return string
11
     */
12
    public function generateFromString($string, $key)
13
    {
14
        $key = pack('H*', $key);
15
        $mac = hash_hmac('sha256', $string, $key);
16
17
        return $mac;
18
    }
19
}