Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
41 | public function hashData($data) |
||
42 | { |
||
43 | if (!is_string($data)) { |
||
1 ignored issue
–
show
|
|||
44 | throw new \InvalidArgumentException('The data for hashing must be a string or a binary string.'); |
||
45 | } |
||
46 | |||
47 | $data = $this->addSaltString($data); |
||
48 | |||
49 | $rawOutput = ($this->digestFormat === self::DIGEST_OUTPUT_RAW); |
||
50 | |||
51 | /** |
||
52 | * {@internal Backward compatibility algorithm for seed must be used. }} |
||
53 | */ |
||
54 | $digest = ($this->useNative) ? |
||
55 | \CryptoManana\Compatibility\NativeSha3::digest256($data, $rawOutput) |
||
56 | : |
||
57 | hash(static::ALGORITHM_NAME, $data, $rawOutput); |
||
58 | |||
59 | $digest = $this->changeOutputFormat($digest); |
||
60 | |||
61 | return $digest; |
||
62 | } |
||
64 |