Open In App

PHP mhash_get_hash_name() Function

Improve
Improve
Like Article
Like
Save
Share
Report

The mhash_get_hash_name() function is an inbuilt function in PHP which is used to get the block size of the specified hash. It gets the highest available hash ID within the current MHash installed in the system like SHA1, MD%, etc.

Syntax:

string mhash_get_hash_name( int $hash )

Parameter: This function accepts single parameter as mentioned above and described below:

  • $Hash: This the hash ID. One of the mhash_name constants.

Return Value: This function returns only hash name which contains the list of supported hashing algorithms.

Example: The following example illustrates the mhash_get_hash_name() function in PHP.

PHP




<?php
  
$maxHashCount = mhash_count();
  
for ($hashNumber = 0; $hashNumber 
  <= $maxHashCount; $hashNumber++) {
  
    // i-th hash name
    $hashName = mhash_get_hash_name($hashNumber);
  
    // i-th block size
    print_r($hashName."\n");        
}
?>


Output:

CRC32
MD5
SHA1
HAVAL256

RIPEMD160

TIGER
GOST
CRC32B
HAVAL224
HAVAL192
HAVAL160
HAVAL128
TIGER128
TIGER160
MD4
SHA256
ADLER32
SHA224
SHA512
SHA384
WHIRLPOOL
RIPEMD128
RIPEMD256
RIPEMD320

SNEFRU256
MD2
FNV132
FNV1A32
FNV164
FNV1A64
JOAAT

Reference: https://www.php.net/manual/en/function.mhash-get-hash-name.php


Last Updated : 21 Aug, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads