Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ПОДПИСКА

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.




Mhash Functions

XXXVI. Mhash Functions

These functions are intended to work with mhash.

This is an interface to the mhash library. mhash supports a wide variety of hash algorithms such as MD5, SHA1, GOST, and many others.

To use it, download the mhash distribution from its web site and follow the included installation instructions. You need to compile PHP with the --with-mhash parameter to enable this extension.

Mhash can be used to create checksums, message digests, and more.

Example 1. Compute the SHA1 key and print it out as hex


<?php
$input = "Let us meet at 9 o' clock at the secret place.";
$hash = mhash (MHASH_SHA1, $input);

print "The hash is ".bin2hex ($hash)."\n";
?>
     
This will produce:

The hash is d3b85d710d8f6e4e5efd4d5e67d041f9cecedafe
    
For a complete list of supported hashes, refer to the documentation of mhash. The general rule is that you can access the hash algorithm from PHP with MHASH_HASHNAME. For example, to access HAVAL you use the PHP constant MHASH_HAVAL.

Here is a list of hashes which are currently supported by mhash. If a hash is not listed here, but is listed by mhash as supported, you can safely assume that this documentation is outdated.

  • MHASH_MD5

  • MHASH_SHA1

  • MHASH_HAVAL

  • MHASH_RIPEMD160

  • MHASH_RIPEMD128

  • MHASH_SNEFRU

  • MHASH_TIGER

  • MHASH_GOST

  • MHASH_CRC32

  • MHASH_CRC32B

Table of Contents
mhash_get_hash_name — Get the name of the specified hash
mhash_get_block_size — Get the block size of the specified hash
mhash_count — Get the highest available hash id
mhash — Compute hash


With any suggestions or questions please feel free to contact us