PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/stubs/hash.php

http://github.com/nnmatveev/php-stubs
PHP | 312 lines | 45 code | 20 blank | 247 comment | 0 complexity | b9316e033c21549c652ef4bb893e5361 MD5 | raw file
  1. <?php
  2. // Start of hash v.1.0
  3. /**
  4. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  5. * Generate a hash value (message digest)
  6. * @link http://php.net/manual/en/function.hash.php
  7. * @param string $algo <p>
  8. * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
  9. * </p>
  10. * @param string $data <p>
  11. * Message to be hashed.
  12. * </p>
  13. * @param bool $raw_output [optional] <p>
  14. * When set to true, outputs raw binary data.
  15. * false outputs lowercase hexits.
  16. * </p>
  17. * @return string a string containing the calculated message digest as lowercase hexits
  18. * unless raw_output is set to true in which case the raw
  19. * binary representation of the message digest is returned.
  20. */
  21. function hash ($algo, $data, $raw_output = null) {}
  22. /**
  23. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  24. * Generate a hash value using the contents of a given file
  25. * @link http://php.net/manual/en/function.hash-file.php
  26. * @param string $algo <p>
  27. * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
  28. * </p>
  29. * @param string $filename <p>
  30. * URL describing location of file to be hashed; Supports fopen wrappers.
  31. * </p>
  32. * @param bool $raw_output [optional] <p>
  33. * When set to true, outputs raw binary data.
  34. * false outputs lowercase hexits.
  35. * </p>
  36. * @return string a string containing the calculated message digest as lowercase hexits
  37. * unless raw_output is set to true in which case the raw
  38. * binary representation of the message digest is returned.
  39. */
  40. function hash_file ($algo, $filename, $raw_output = null) {}
  41. /**
  42. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  43. * Generate a keyed hash value using the HMAC method
  44. * @link http://php.net/manual/en/function.hash-hmac.php
  45. * @param string $algo <p>
  46. * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
  47. * </p>
  48. * @param string $data <p>
  49. * Message to be hashed.
  50. * </p>
  51. * @param string $key <p>
  52. * Shared secret key used for generating the HMAC variant of the message digest.
  53. * </p>
  54. * @param bool $raw_output [optional] <p>
  55. * When set to true, outputs raw binary data.
  56. * false outputs lowercase hexits.
  57. * </p>
  58. * @return string a string containing the calculated message digest as lowercase hexits
  59. * unless raw_output is set to true in which case the raw
  60. * binary representation of the message digest is returned.
  61. */
  62. function hash_hmac ($algo, $data, $key, $raw_output = null) {}
  63. /**
  64. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  65. * Generate a keyed hash value using the HMAC method and the contents of a given file
  66. * @link http://php.net/manual/en/function.hash-hmac-file.php
  67. * @param string $algo <p>
  68. * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
  69. * </p>
  70. * @param string $filename <p>
  71. * URL describing location of file to be hashed; Supports fopen wrappers.
  72. * </p>
  73. * @param string $key <p>
  74. * Shared secret key used for generating the HMAC variant of the message digest.
  75. * </p>
  76. * @param bool $raw_output [optional] <p>
  77. * When set to true, outputs raw binary data.
  78. * false outputs lowercase hexits.
  79. * </p>
  80. * @return string a string containing the calculated message digest as lowercase hexits
  81. * unless raw_output is set to true in which case the raw
  82. * binary representation of the message digest is returned.
  83. */
  84. function hash_hmac_file ($algo, $filename, $key, $raw_output = null) {}
  85. /**
  86. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  87. * Initialize an incremental hashing context
  88. * @link http://php.net/manual/en/function.hash-init.php
  89. * @param string $algo <p>
  90. * Name of selected hashing algorithm (i.e. "md5", "sha256", "haval160,4", etc..)
  91. * </p>
  92. * @param int $options [optional] <p>
  93. * Optional settings for hash generation, currently supports only one option:
  94. * HASH_HMAC. When specified, the key
  95. * must be specified.
  96. * </p>
  97. * @param string $key [optional] <p>
  98. * When HASH_HMAC is specified for options,
  99. * a shared secret key to be used with the HMAC hashing method must be supplied in this
  100. * parameter.
  101. * </p>
  102. * @return resource a Hashing Context resource for use with hash_update,
  103. * hash_update_stream, hash_update_file,
  104. * and hash_final.
  105. */
  106. function hash_init ($algo, $options = null, $key = null) {}
  107. /**
  108. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  109. * Pump data into an active hashing context
  110. * @link http://php.net/manual/en/function.hash-update.php
  111. * @param resource $context <p>
  112. * Hashing context returned by hash_init.
  113. * </p>
  114. * @param string $data <p>
  115. * Message to be included in the hash digest.
  116. * </p>
  117. * @return bool true.
  118. */
  119. function hash_update ($context, $data) {}
  120. /**
  121. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  122. * Pump data into an active hashing context from an open stream
  123. * @link http://php.net/manual/en/function.hash-update-stream.php
  124. * @param resource $context <p>
  125. * Hashing context returned by hash_init.
  126. * </p>
  127. * @param resource $handle <p>
  128. * Open file handle as returned by any stream creation function.
  129. * </p>
  130. * @param int $length [optional] <p>
  131. * Maximum number of characters to copy from handle
  132. * into the hashing context.
  133. * </p>
  134. * @return int Actual number of bytes added to the hashing context from handle.
  135. */
  136. function hash_update_stream ($context, $handle, $length = null) {}
  137. /**
  138. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  139. * Pump data into an active hashing context from a file
  140. * @link http://php.net/manual/en/function.hash-update-file.php
  141. * @param resource $context <p>
  142. * Stream context as returned by stream_context_create.
  143. * </p>
  144. * @param string $filename <p>
  145. * URL describing location of file to be hashed; Supports fopen wrappers.
  146. * </p>
  147. * @param resource $context [optional]
  148. * @return bool Returns true on success or false on failure.
  149. */
  150. function hash_update_file ($context, $filename, $context = null) {}
  151. /**
  152. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  153. * Finalize an incremental hash and return resulting digest
  154. * @link http://php.net/manual/en/function.hash-final.php
  155. * @param resource $context <p>
  156. * Hashing context returned by hash_init.
  157. * </p>
  158. * @param bool $raw_output [optional] <p>
  159. * When set to true, outputs raw binary data.
  160. * false outputs lowercase hexits.
  161. * </p>
  162. * @return string a string containing the calculated message digest as lowercase hexits
  163. * unless raw_output is set to true in which case the raw
  164. * binary representation of the message digest is returned.
  165. */
  166. function hash_final ($context, $raw_output = null) {}
  167. /**
  168. * (PHP 5 &gt;= 5.3.0)<br/>
  169. * Copy hashing context
  170. * @link http://php.net/manual/en/function.hash-copy.php
  171. * @param resource $context <p>
  172. * Hashing context returned by hash_init.
  173. * </p>
  174. * @return resource a copy of Hashing Context resource.
  175. */
  176. function hash_copy ($context) {}
  177. /**
  178. * (PHP 5 &gt;= 5.1.2, PECL hash &gt;= 1.1)<br/>
  179. * Return a list of registered hashing algorithms
  180. * @link http://php.net/manual/en/function.hash-algos.php
  181. * @return array a numerically indexed array containing the list of supported
  182. * hashing algorithms.
  183. */
  184. function hash_algos () {}
  185. /**
  186. * (PHP 4 &gt;= 4.0.4, PHP 5)<br/>
  187. * Generates a key
  188. * @link http://php.net/manual/en/function.mhash-keygen-s2k.php
  189. * @param int $hash <p>
  190. * The hash id used to create the key.
  191. * One of the MHASH_XXX constants.
  192. * </p>
  193. * @param string $password <p>
  194. * User supplied password.
  195. * </p>
  196. * @param string $salt <p>
  197. * Must be different and random enough for every key you generate in
  198. * order to create different keys. That salt must be known when you check
  199. * the keys, thus it is a good idea to append the key to it. Salt has a
  200. * fixed length of 8 bytes and will be padded with zeros if you supply
  201. * less bytes.
  202. * </p>
  203. * @param int $bytes <p>
  204. * The key length, in bytes.
  205. * </p>
  206. * @return string the generated key as a string, or false on error.
  207. */
  208. function mhash_keygen_s2k ($hash, $password, $salt, $bytes) {}
  209. /**
  210. * (PHP 4, PHP 5)<br/>
  211. * Get the block size of the specified hash
  212. * @link http://php.net/manual/en/function.mhash-get-block-size.php
  213. * @param int $hash <p>
  214. * The hash id. One of the MHASH_XXX constants.
  215. * </p>
  216. * @return int the size in bytes or false, if the hash
  217. * does not exist.
  218. */
  219. function mhash_get_block_size ($hash) {}
  220. /**
  221. * (PHP 4, PHP 5)<br/>
  222. * Get the name of the specified hash
  223. * @link http://php.net/manual/en/function.mhash-get-hash-name.php
  224. * @param int $hash <p>
  225. * The hash id. One of the MHASH_XXX constants.
  226. * </p>
  227. * @return string the name of the hash or false, if the hash does not exist.
  228. */
  229. function mhash_get_hash_name ($hash) {}
  230. /**
  231. * (PHP 4, PHP 5)<br/>
  232. * Get the highest available hash id
  233. * @link http://php.net/manual/en/function.mhash-count.php
  234. * @return int the highest available hash id. Hashes are numbered from 0 to this
  235. * hash id.
  236. */
  237. function mhash_count () {}
  238. /**
  239. * (PHP 4, PHP 5)<br/>
  240. * Compute hash
  241. * @link http://php.net/manual/en/function.mhash.php
  242. * @param int $hash <p>
  243. * The hash id. One of the MHASH_XXX constants.
  244. * </p>
  245. * @param string $data <p>
  246. * The user input, as a string.
  247. * </p>
  248. * @param string $key [optional] <p>
  249. * If specified, the function will return the resulting HMAC instead.
  250. * HMAC is keyed hashing for message authentication, or simply a message
  251. * digest that depends on the specified key. Not all algorithms
  252. * supported in mhash can be used in HMAC mode.
  253. * </p>
  254. * @return string the resulting hash (also called digest) or HMAC as a string, or
  255. * false on errors.
  256. */
  257. function mhash ($hash, $data, $key = null) {}
  258. /**
  259. * Optional flag for hash_init.
  260. * Indicates that the HMAC digest-keying algorithm should be
  261. * applied to the current hashing context.
  262. * @link http://php.net/manual/en/hash.constants.php
  263. */
  264. define ('HASH_HMAC', 1);
  265. define ('MHASH_CRC32', 0);
  266. define ('MHASH_MD5', 1);
  267. define ('MHASH_SHA1', 2);
  268. define ('MHASH_HAVAL256', 3);
  269. define ('MHASH_RIPEMD160', 5);
  270. define ('MHASH_TIGER', 7);
  271. define ('MHASH_GOST', 8);
  272. define ('MHASH_CRC32B', 9);
  273. define ('MHASH_HAVAL224', 10);
  274. define ('MHASH_HAVAL192', 11);
  275. define ('MHASH_HAVAL160', 12);
  276. define ('MHASH_HAVAL128', 13);
  277. define ('MHASH_TIGER128', 14);
  278. define ('MHASH_TIGER160', 15);
  279. define ('MHASH_MD4', 16);
  280. define ('MHASH_SHA256', 17);
  281. define ('MHASH_ADLER32', 18);
  282. define ('MHASH_SHA224', 19);
  283. define ('MHASH_SHA512', 20);
  284. define ('MHASH_SHA384', 21);
  285. define ('MHASH_WHIRLPOOL', 22);
  286. define ('MHASH_RIPEMD128', 23);
  287. define ('MHASH_RIPEMD256', 24);
  288. define ('MHASH_RIPEMD320', 25);
  289. define ('MHASH_SNEFRU256', 27);
  290. define ('MHASH_MD2', 28);
  291. // End of hash v.1.0
  292. ?>