PHP: Mhash funkce - Manual
PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links | my php.net 
search for in the  
<memcache_debugmhash_count>
view the version of this page
Last updated: Thu, 15 Jul 2004

LX. Mhash funkce

�vod

Tyto funkce jsou ur�eny pro pr�ci s . Mhash lze pou��t pro vytvo�en� kontroln�ch sou�t�, otisk� zpr�v, autentiza�n�ch k�d� zpr�v atd.

Toto je rozhran� ke knihovn� mhash. mhash podporuje �irokou �k�lu hash algoritm� jako nap�. MD5, SHA1, GOST a mnoho jin�ch. Kompletn� seznam podporovan�ch hash algoritm� naleznete v dokumentaci knohovny mhash. Obecn� pravidlo je, �e k hash algoritmu lze z PHP p�istupovat p�es MHASH_N�ZEVHASHE. Nap��klad pro hash TIGER pou�ijte PHP konstantu MHASH_TIGER.

Po�adavky

Pokud chcete tyto funkce pou��vat, st�hn�te si mhash distribuci z a postupujte podle p�ilo�en�ch instrukc� k instalaci.

Instalace

K aktivaci tohoto modulu budete muset zkompilovat PHP s volbou --with-mhash. DIR je instala�n� adres�� mhash.

Konfigurace b�hu

Toto roz���en� nem� definov�no ��dn� konfigura�n� direktivy.

Typy prost�edk�

Toto roz���en� nem� definov�n ��dn� typ prost�edku (resource).

P�eddefinovan� konstanty

Tyto konstanty jsou definov�ny t�mto roz���en�m a budou k dispozici pouze tehdy, bylo-li roz���en� zkompilov�no spole�n� s PHP nebo dynamicky zavedeno za b�hu.

Zde je seznam hash� podporovan�ch mhashem v sou�asn� dob�. Pokud zde nen� n�kter� hash jmenov�n, ale v dokumentaci mhashe je uveden jako podporovan�, m��ete bezpe�n� p�edpokl�dat, �e je tato dokumentace zastaral�.

  • MHASH_MD5

  • MHASH_SHA1

  • MHASH_HAVAL256

  • MHASH_HAVAL192

  • MHASH_HAVAL160

  • MHASH_HAVAL128

  • MHASH_RIPEMD160

  • MHASH_GOST

  • MHASH_TIGER

  • MHASH_CRC32

  • MHASH_CRC32B

P��klady

P��klad 1. Vypo��tat MD5 otisk a hmac a vypsat je v hexadecim�ln�m tvaru

<?php
$input
= "what do ya want for nothing?";
$hash = mhash (MHASH_MD5, $input);
print
"Hash je ".bin2hex ($hash)."<br />\n";
$hash = mhash (MHASH_MD5, $input, "Jefe");
print
"Hmac je ".bin2hex ($hash)."<br />\n";
?>

This will produce:
Hash je d03cb659cbf9192dcd066272249f8412 
Hmac je 750c783e6ab0b503eaa86e310a5db738

Obsah
mhash_count -- Z�skat nejvy��� dostupn� hash id
mhash_get_block_size -- Z�skat velikost bloku ur�en�ho hashe
mhash_get_hash_name -- Z�skat n�zev zadan�ho hashe
mhash_keygen_s2k -- Vygenerovat kl��
mhash -- Spo��tat hash


add a note add a note User Contributed Notes
Mhash funkce
sergeyev_v_v AT mail DOT ru
16-Jul-2004 11:45
It is't necessary to copy something to windows/system32, cause it is source of problems.
You must use PHPRC environment variable:
SET PHPRC=c:\PathToYourPHPDirectory; (win cmd.exe)
or
export PHPRC ... (for linux bash)
m1tk4 at hotmail dot com
22-Jun-2004 05:43
To enable mhash on RHEL/Fedora Core/other RPM-based Linuxes without rebuilding PHP, get the php-mhash and mhash RPMs at
prakashshakya at hotmail dot com
01-Jun-2004 10:56
Also put php_mhash.dll in windows directory in addition to above setting in case of apache 1.3.1
JP Solatorio
29-May-2004 04:14
To enable mhash in PHP 4.3.6 running under Apache2, Windows (mine is XP), do the following:

1. Uncomment the line extension=php_mhash.dll from the php.ini file. Save.
2. Copy libmhash.dll from the dlls folder of your PHP directory, and save it to the system32 directory.
3. Restart Server.
01-Aug-2001 02:13
MHASH_HAVAL256 , MHASH_HAVAL192, etc...
refers to the HAVAL hash with 3 rounds.

To use HAVAL with 4 or 5 rounds, you have to
recompile the mhash library and either add
new hash names, or just change in mhash.c
the definitions of MHASH_HAVAL256,...

<memcache_debugmhash_count>
 Last updated: Thu, 15 Jul 2004
show source | credits | sitemap | contact | advertising | mirror sites 
Copyright © 2001-2004 The PHP Group
All rights reserved.
This unofficial mirror is operated at: /
Last updated: Sun Nov 14 23:09:54 2004 Local time zone must be set--see zic manual page