00 Votes

PHP: Difference between hash and mhash

Question by Sledge | 2012-07-11 at 19:44

PHP provides the hash functions hash and mhash to compute a hash. As I look over this, the two functions seem to do exactly the same.

So, why are there two functions for calculating hashs, and what is the difference, if there is one?

ReplyPositiveNegative
0Best Answer0 Votes

The function hash has replaced mhash in PHP 5. On the PHP website, it also says to mhash: "This extension is obsoulted by hash".

Mhash was an extension to PHP, which had to be installed separately and was not part of the standard PHP. However, the function hash is part of PHP.

Probably, the developers of PHP have decided to do that, because the functions are often used.

Whether the two functions are also implemented in another way, I do not know, but you can use both functions to calculate hash values.

So, if you are using an older version of PHP than PHP 5, you have to use mhash, otherwise you should use hash.
2012-07-13 at 16:44

ReplyPositive Negative
Reply

Related Topics

Calculate Hash using PHP

Info | 0 Comments

PHP: Current Date and Time

Tutorial | 0 Comments

PHP: Upload of large Files

Tutorial | 0 Comments

PHP: Sending an E-Mail

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.