PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.3.0
Defender Security – Malware Scanner, Login Security & Firewall v6.3.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Safe / generated / hash.php

hash.php in Defender Security – Malware Scanner, Login Security & Firewall 6.3.0, at lib/packages/Safe/generated/hash.php

62 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WP_DEFENDER_VENDOR\Safe;
4
5 use WP_DEFENDER_VENDOR\Safe\Exceptions\HashException;
6
7 /**
8 *
9 *
10 * @param string $algo Name of selected hashing algorithm (i.e. "sha256", "sha512", "haval160,4", etc..)
11 * See hash_algos for a list of supported algorithms.
12 *
13 *
14 * Non-cryptographic hash functions are not allowed.
15 *
16 *
17 *
18 * Non-cryptographic hash functions are not allowed.
19 * @param string $ikm Input keying material (raw binary). Cannot be empty.
20 * @param int $length Desired output length in bytes.
21 * Cannot be greater than 255 times the chosen hash function size.
22 *
23 * If length is 0, the output length
24 * will default to the chosen hash function size.
25 * @param string $info Application/context-specific info string.
26 * @param string $salt Salt to use during derivation.
27 *
28 * While optional, adding random salt significantly improves the strength of HKDF.
29 * @return string Returns a string containing a raw binary representation of the derived key
30 * (also known as output keying material - OKM);.
31 * @throws HashException
32 *
33 */
34 function hash_hkdf(string $algo, string $ikm, int $length = 0, string $info = '', string $salt = ''): string
35 {
36 error_clear_last();
37 $result = \hash_hkdf($algo, $ikm, $length, $info, $salt);
38 if ($result === false) {
39 throw HashException::createFromPhpError();
40 }
41 return $result;
42 }
43
44
45 /**
46 *
47 *
48 * @param \HashContext $hcontext Hashing context returned by hash_init.
49 * @param string $filename URL describing location of file to be hashed; Supports fopen wrappers.
50 * @param \HashContext|null $scontext Stream context as returned by stream_context_create.
51 * @throws HashException
52 *
53 */
54 function hash_update_file(\HashContext $hcontext, string $filename, ?\HashContext $scontext = null): void
55 {
56 error_clear_last();
57 $result = \hash_update_file($hcontext, $filename, $scontext);
58 if ($result === false) {
59 throw HashException::createFromPhpError();
60 }
61 }
62