Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



What is the Mhash in PHP?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 07-03-2010
Member
 
Join Date: Aug 2006
Posts: 201
What is the Mhash in PHP?
  

Hello friends,
I have done the basic things that are required for PHP programming language. Now I am studying about the extensions that are used for a cryptography. In that I have not understood about the Mhash, so thought to take some help from you guys.!! Please tell me what is the Mhash in PHP? Thanks in Advance.!!

__________________
Don't be afraid of darkness, it's in your heart anyway.
Reply With Quote
  #2  
Old 07-03-2010
Member
 
Join Date: Jul 2006
Posts: 289
Re: What is the Mhash in PHP?

These functions are intended to work with "mhash. Mhash can be used to create a checksum, hash and more. This set of functions is an interface to the mhash library. Mhash accepts many different algorithms, like MD5, SHA1, GOST, and many others. For a complete list of supported hashes, refer to the documentation of mhash. The general rule is that you can access an algorithm from PHP with constant MHASH_HASHNAME. For example, to access TIGER algorithm, you can use the constant MHASH_TIGER. This extension is obsolete. Please use the extension Hash instead.
__________________
Signatures reduce available bandwidth
Reply With Quote
  #3  
Old 07-03-2010
Member
 
Join Date: Aug 2006
Posts: 235
Re: What is the Mhash in PHP?

You will need to compile PHP with - with-mhash [= DIR] to enable this extension. DIR is the installation folder for the mhash library. Since PHP 5.3.0, mhash extension is emulated through extension Hash. Also, the option to specify the installation folder mhash has no effect, and this extension requires the installation of the extension for hash function. DIR is not the installation directory, it is the directory that contains the compiled source files. You should keep in mind that this extension does not define any configuration directive.
__________________
3.2 (northwood)
2gig ram
ATI AIW X800xt 256mb
Gigabyte GA-8knxp 875p Chipset
Optiwrite 8X DVD Burner
Win XP PRO Sp2 (Works Perfectly)
2 SATA Raptor 74gig Raid 0
2 7200 IDE 320gig HD
Reply With Quote
  #4  
Old 07-03-2010
Member
 
Join Date: Mar 2008
Posts: 672
Re: What is the Mhash in PHP?

The following are the Predefined Constants which are defined by this extension, and are only available when the extension has been compiled into PHP or dynamically loaded at runtime. Here is a list of modes that are supported by mhash :
  • MHASH_ADLER32
  • MHASH_CRC32
  • MHASH_CRC32B
  • MHASH_GOST
  • MHASH_HAVAL128
  • MHASH_HAVAL160
  • MHASH_HAVAL192
  • MHASH_HAVAL256
  • MHASH_MD4
  • MHASH_MD5
Reply With Quote
  #5  
Old 07-03-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: What is the Mhash in PHP?

I am providing you the Mhash Functions, that can be very useful while doing the coding :
  • mhash_count - Get the maximum hash identifier
  • mhash_get_block_size - Returns the blocksize of the hash
  • mhash_get_hash_name - Returns the name of the hash
  • mhash_keygen_s2k - Generates a key
  • mhash - Compute hash
Reply With Quote
  #6  
Old 07-03-2010
Member
 
Join Date: Nov 2008
Posts: 996
Re: What is the Mhash in PHP?

The following is an example of the computing the MD5 digest and hmac, and also prints it out as Hex :
PHP Code:
<?php
$input 
"So what are you doing?";
$hash mhash(MHASH_MD5$input);
echo 
"The hash is " bin2hex($hash) . "<br />\n";
$hash mhash(MHASH_MD5$input"Jefe");
echo 
"The hmac is " bin2hex($hash) . "<br />\n";
?>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search



All times are GMT +5.5. The time now is 04:20 PM.