PHP : Function Reference : hash Functions
Message Digest (hash) engine. Allows direct or incremental processing
of arbitrary length messages using a variety of hashing algorithms.
The Hash extension requires no external libraries and is enabled by
default as of PHP 5.1.2. It may be explicitly disabled by using the
--disable-hash switch to configure. Earlier versions of PHP may
incorporate the Hash extension by installing the
» PECL module.
This extension defines a Hashing Context resource returned by
hash_init().
The constants below are defined by this extension, and
will only be available when the extension has either
been compiled into PHP or dynamically loaded at runtime.
-
HASH_HMAC
(integer)
-
Optional flag for hash_init().
Indicates that the HMAC digest-keying algorithm should be
applied to the current hashing context.
Table of Contents
-
hash_algos — Return a list of registered hashing algorithms
-
hash_file — Generate a hash value using the contents of a given file
-
hash_final — Finalize an incremental hash and return resulting digest
-
hash_hmac_file — Generate a keyed hash value using the HMAC method and the contents of a given file
-
hash_hmac — Generate a keyed hash value using the HMAC method
-
hash_init — Initialize an incremental hashing context
-
hash_update_file — Pump data into an active hashing context from a file
-
hash_update_stream — Pump data into an active hashing context from an open stream
-
hash_update — Pump data into an active hashing context
-
hash — Generate a hash value (message digest)
nb_removethis_
Some tests with mhash and hash revealed on my machine that hash needs more than twice as long to create a hash than mhash. The average of one million cylces of Haval128, Haval256, Gost, CRC32, MD5, SHA1 and SHA256 was 450ms for mhash and 1150ms for hash.
rbemrose
martin: That's because some distributions, such as FreeBSD's ports and Debian's apt split PHP's modules into different packages.
martin
I tried to use Hash() function on my PHP 5.2.3 (FreeBSD 6.2) but there was no Hash() function. (it should be available by default from version 5.1.2)
Hash() function was working after installing "security/pecl-hash" port.
|