mhash_get_hash_name

string mhash_get_hash_name(const hash) 

Gets the name of the specified hash algorithm.

Returns:

Name of the specified hash algorithm; FALSE on error

Description:

mhash_get_hash_name() gets the name of the specified hash algorithm. In PHP, the name of the hash normally has 'MHASH_' prepended. This function returns the actual name of the hash; it could be used to determine what hash algorithms are available.

Version:

Existing since versions 3.0.9 and 4.0

Example:

Print the names of available hash algorithms
<?php 
$hashcount = mhash_count(); 
for ($i = 0; $i <= $hashcount; $i++) {
    printf("%s\n",mhash_get_hash_name($i)); 
} 
?> 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.