| 1 |
<?php |
| 2 |
|
| 3 |
// Start of hash v.1.0 |
| 4 |
|
| 5 |
/** |
| 6 |
* Generate a hash value (message digest) |
| 7 |
* @link http://www.php.net/manual/en/function.hash.php |
| 8 |
* @param algo string <p> |
| 9 |
* Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) |
| 10 |
* </p> |
| 11 |
* @param data string <p> |
| 12 |
* Message to be hashed. |
| 13 |
* </p> |
| 14 |
* @param raw_output bool[optional] <p> |
| 15 |
* When set to true, outputs raw binary data. |
| 16 |
* false outputs lowercase hexits. |
| 17 |
* </p> |
| 18 |
* @return string a string containing the calculated message digest as lowercase hexits |
| 19 |
* unless raw_output is set to true in which case the raw |
| 20 |
* binary representation of the message digest is returned. |
| 21 |
*/ |
| 22 |
function hash ($algo, $data, $raw_output = null) {} |
| 23 |
|
| 24 |
/** |
| 25 |
* Generate a hash value using the contents of a given file |
| 26 |
* @link http://www.php.net/manual/en/function.hash-file.php |
| 27 |
* @param algo string <p> |
| 28 |
* Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) |
| 29 |
* </p> |
| 30 |
* @param filename string <p> |
| 31 |
* URL describing location of file to be hashed; Supports fopen wrappers. |
| 32 |
* </p> |
| 33 |
* @param raw_output bool[optional] <p> |
| 34 |
* When set to true, outputs raw binary data. |
| 35 |
* false outputs lowercase hexits. |
| 36 |
* </p> |
| 37 |
* @return string a string containing the calculated message digest as lowercase hexits |
| 38 |
* unless raw_output is set to true in which case the raw |
| 39 |
* binary representation of the message digest is returned. |
| 40 |
*/ |
| 41 |
function hash_file ($algo, $filename, $raw_output = null) {} |
| 42 |
|
| 43 |
/** |
| 44 |
* Generate a keyed hash value using the HMAC method |
| 45 |
* @link http://www.php.net/manual/en/function.hash-hmac.php |
| 46 |
* @param algo string <p> |
| 47 |
* Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) See hash_algos for a list of supported algorithms. |
| 48 |
* </p> |
| 49 |
* @param data string <p> |
| 50 |
* Message to be hashed. |
| 51 |
* </p> |
| 52 |
* @param key string <p> |
| 53 |
* Shared secret key used for generating the HMAC variant of the message digest. |
| 54 |
* </p> |
| 55 |
* @param raw_output bool[optional] <p> |
| 56 |
* When set to true, outputs raw binary data. |
| 57 |
* false outputs lowercase hexits. |
| 58 |
* </p> |
| 59 |
* @return string a string containing the calculated message digest as lowercase hexits |
| 60 |
* unless raw_output is set to true in which case the raw |
| 61 |
* binary representation of the message digest is returned. |
| 62 |
* Returns false when algo is unknown. |
| 63 |
*/ |
| 64 |
function hash_hmac ($algo, $data, $key, $raw_output = null) {} |
| 65 |
|
| 66 |
/** |
| 67 |
* Generate a keyed hash value using the HMAC method and the contents of a given file |
| 68 |
* @link http://www.php.net/manual/en/function.hash-hmac-file.php |
| 69 |
* @param algo string <p> |
| 70 |
* Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..) See hash_algos for a list of supported algorithms. |
| 71 |
* </p> |
| 72 |
* @param filename string <p> |
| 73 |
* URL describing location of file to be hashed; Supports fopen wrappers. |
| 74 |
* </p> |
| 75 |
* @param key string <p> |
| 76 |
* Shared secret key used for generating the HMAC variant of the message digest. |
| 77 |
* </p> |
| 78 |
* @param raw_output bool[optional] <p> |
| 79 |
* When set to true, outputs raw binary data. |
| 80 |
* false outputs lowercase hexits. |
| 81 |
* </p> |
| 82 |
* @return string a string containing the calculated message digest as lowercase hexits |
| 83 |
* unless raw_output is set to true in which case the raw |
| 84 |
* binary representation of the message digest is returned. |
| 85 |
*/ |
| 86 |
function hash_hmac_file ($algo, $filename, $key, $raw_output = null) {} |
| 87 |
|
| 88 |
/** |
| 89 |
* Initialize an incremental hashing context |
| 90 |
* @link http://www.php.net/manual/en/function.hash-init.php |
| 91 |
* @param algo string <p> |
| 92 |
* Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..). For a list of supported algorithms see hash_algos. |
| 93 |
* </p> |
| 94 |
* @param options int[optional] <p> |
| 95 |
* Optional settings for hash generation, currently supports only one option: |
| 96 |
* HASH_HMAC. When specified, the key |
| 97 |
* must be specified. |
| 98 |
* </p> |
| 99 |
* @param key string[optional] <p> |
| 100 |
* When HASH_HMAC is specified for options, |
| 101 |
* a shared secret key to be used with the HMAC hashing method must be supplied in this |
| 102 |
* parameter. |
| 103 |
* </p> |
| 104 |
* @return resource a Hashing Context resource for use with hash_update, |
| 105 |
* hash_update_stream, hash_update_file, |
| 106 |
* and hash_final. |
| 107 |
*/ |
| 108 |
function hash_init ($algo, $options = null, $key = null) {} |
| 109 |
|
| 110 |
/** |
| 111 |
* Pump data into an active hashing context |
| 112 |
* @link http://www.php.net/manual/en/function.hash-update.php |
| 113 |
* @param context resource <p> |
| 114 |
* Hashing context returned by hash_init. |
| 115 |
* </p> |
| 116 |
* @param data string <p> |
| 117 |
* Message to be included in the hash digest. |
| 118 |
* </p> |
| 119 |
* @return bool true. |
| 120 |
*/ |
| 121 |
function hash_update ($context, $data) {} |
| 122 |
|
| 123 |
/** |
| 124 |
* Pump data into an active hashing context from an open stream |
| 125 |
* @link http://www.php.net/manual/en/function.hash-update-stream.php |
| 126 |
* @param context resource <p> |
| 127 |
* Hashing context returned by hash_init. |
| 128 |
* </p> |
| 129 |
* @param handle resource <p> |
| 130 |
* Open file handle as returned by any stream creation function. |
| 131 |
* </p> |
| 132 |
* @param length int[optional] <p> |
| 133 |
* Maximum number of characters to copy from handle |
| 134 |
* into the hashing context. |
| 135 |
* </p> |
| 136 |
* @return int Actual number of bytes added to the hashing context from handle. |
| 137 |
*/ |
| 138 |
function hash_update_stream ($context, $handle, $length = null) {} |
| 139 |
|
| 140 |
/** |
| 141 |
* Pump data into an active hashing context from a file |
| 142 |
* @link http://www.php.net/manual/en/function.hash-update-file.php |
| 143 |
* @param hcontext resource <p> |
| 144 |
* Hashing context returned by hash_init. |
| 145 |
* </p> |
| 146 |
* @param filename string <p> |
| 147 |
* URL describing location of file to be hashed; Supports fopen wrappers. |
| 148 |
* </p> |
| 149 |
* @param scontext resource[optional] <p> |
| 150 |
* Stream context as returned by stream_context_create. |
| 151 |
* </p> |
| 152 |
* @return bool Returns true on success, false on failure. |
| 153 |
*/ |
| 154 |
function hash_update_file ($hcontext, $filename, $scontext = null) {} |
| 155 |
|
| 156 |
/** |
| 157 |
* Finalize an incremental hash and return resulting digest |
| 158 |
* @link http://www.php.net/manual/en/function.hash-final.php |
| 159 |
* @param context resource <p> |
| 160 |
* Hashing context returned by hash_init. |
| 161 |
* </p> |
| 162 |
* @param raw_output bool[optional] <p> |
| 163 |
* When set to true, outputs raw binary data. |
| 164 |
* false outputs lowercase hexits. |
| 165 |
* </p> |
| 166 |
* @return string a string containing the calculated message digest as lowercase hexits |
| 167 |
* unless raw_output is set to true in which case the raw |
| 168 |
* binary representation of the message digest is returned. |
| 169 |
*/ |
| 170 |
function hash_final ($context, $raw_output = null) {} |
| 171 |
|
| 172 |
/** |
| 173 |
* Copy hashing context |
| 174 |
* @link http://www.php.net/manual/en/function.hash-copy.php |
| 175 |
* @param context resource <p> |
| 176 |
* Hashing context returned by hash_init. |
| 177 |
* </p> |
| 178 |
* @return resource a copy of Hashing Context resource. |
| 179 |
*/ |
| 180 |
function hash_copy ($context) {} |
| 181 |
|
| 182 |
/** |
| 183 |
* Return a list of registered hashing algorithms |
| 184 |
* @link http://www.php.net/manual/en/function.hash-algos.php |
| 185 |
* @return array a numerically indexed array containing the list of supported |
| 186 |
* hashing algorithms. |
| 187 |
*/ |
| 188 |
function hash_algos () {} |
| 189 |
|
| 190 |
/** |
| 191 |
* Generate a PBKDF2 key derivation of a supplied password |
| 192 |
* @link http://www.php.net/manual/en/function.hash-pbkdf2.php |
| 193 |
* @param algo |
| 194 |
* @param password |
| 195 |
* @param salt |
| 196 |
* @param iterations |
| 197 |
* @param length[optional] |
| 198 |
* @param raw_output[optional] |
| 199 |
*/ |
| 200 |
function hash_pbkdf2 ($algo, $password, $salt, $iterations, $length, $raw_output) {} |
| 201 |
|
| 202 |
/** |
| 203 |
* Timing attack safe string comparison |
| 204 |
* @link http://www.php.net/manual/en/function.hash-equals.php |
| 205 |
* @param known_string string <p> |
| 206 |
* The string of known length to compare against |
| 207 |
* </p> |
| 208 |
* @param user_string string <p> |
| 209 |
* The user-supplied string |
| 210 |
* </p> |
| 211 |
* @return bool true when the two strings are equal, false otherwise. |
| 212 |
*/ |
| 213 |
function hash_equals ($known_string, $user_string) {} |
| 214 |
|
| 215 |
|
| 216 |
/** |
| 217 |
* Optional flag for hash_init. |
| 218 |
* Indicates that the HMAC digest-keying algorithm should be |
| 219 |
* applied to the current hashing context. |
| 220 |
* @link http://www.php.net/manual/en/hash.constants.php |
| 221 |
*/ |
| 222 |
define ('HASH_HMAC', 1); |
| 223 |
|
| 224 |
// End of hash v.1.0 |
| 225 |
?> |