| 1 |
<?php |
| 2 |
/** |
| 3 |
* The interface for hasher class. |
| 4 |
* |
| 5 |
* @package WP_Defender\Component\Altcha\Hasher |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WP_Defender\Component\Altcha\Hasher; |
| 9 |
|
| 10 |
interface HasherInterface { |
| 11 |
/** |
| 12 |
* Hashes the given data using the specified algorithm. |
| 13 |
* |
| 14 |
* @param string $algorithm The hashing algorithm to use. |
| 15 |
* @param string $data The data to hash. |
| 16 |
* |
| 17 |
* @return string The hashed data. |
| 18 |
*/ |
| 19 |
public function hash( string $algorithm, string $data ): string; |
| 20 |
|
| 21 |
/** |
| 22 |
* Hashes the given data using the specified algorithm and returns the hash in hexadecimal format. |
| 23 |
* |
| 24 |
* @param string $algorithm The hashing algorithm to use. |
| 25 |
* @param string $data The data to hash. |
| 26 |
* |
| 27 |
* @return string The hashed data in hexadecimal format. |
| 28 |
*/ |
| 29 |
public function hash_hex( string $algorithm, string $data ): string; |
| 30 |
|
| 31 |
/** |
| 32 |
* Hashes the given data using HMAC with the specified algorithm and HMAC key. |
| 33 |
* |
| 34 |
* @param string $algorithm The hashing algorithm to use. |
| 35 |
* @param string $data The data to hash. |
| 36 |
* @param string $hmac_key The HMAC key to use. |
| 37 |
* |
| 38 |
* @return string The HMAC hashed data. |
| 39 |
*/ |
| 40 |
public function hash_hmac( string $algorithm, string $data, string $hmac_key ): string; |
| 41 |
|
| 42 |
/** |
| 43 |
* Hashes the given data using HMAC with the specified algorithm and HMAC key, returning the hash in hexadecimal format. |
| 44 |
* |
| 45 |
* @param string $algorithm The hashing algorithm to use. |
| 46 |
* @param string $data The data to hash. |
| 47 |
* @param string $hmac_key The HMAC key to use. |
| 48 |
* |
| 49 |
* @return string The HMAC hashed data in hexadecimal format. |
| 50 |
*/ |
| 51 |
public function hash_hmac_hex( string $algorithm, string $data, string $hmac_key ): string; |
| 52 |
} |
| 53 |
|