PHP openssl_get_md_methods() Function

The openssl_get_md_methods() function is an inbuilt function in PHP that is used to retrieve a list of available digest (message digest) methods supported by OpenSSL.
Syntax:
openssl_get_md_methods(bool $aliases = false): array
Parameters: This function accepts one parameter which is described below.
- $aliases: If $aliases are true, any aliases for the digest methods will be included in the array.
Return Values: This function returns an array of strings representing the available digest methods supported by OpenSSL. If no digest methods are available, it will return “false”.
Example 1: The following program demonstrates the openssl_get_md_methods() function.
PHP
| <?php $digest_methods= openssl_get_md_methods();  if($digest_methods!== false) {     echo"Available digest methods:\n";     foreach($digest_methodsas$method) {         echo"- $method\n";     } } else{     echo"No digest methods available."; } ?> | 
Output:
Available digest methods: - blake2b512 - blake2s256 - md4 - md5 - md5-sha1 - ripemd160 - sha1 - sha224 - sha256 - sha3-224 - sha3-256 - sha3-384 - sha3-512 - sha384 - sha512 - sha512-224 - sha512-256 - shake128 - shake256 - sm3 - whirlpool
Example 2: The following program demonstrates the openssl_get_md_methods() function.
PHP
| <?php $digest_methods= openssl_get_md_methods();  if($digest_methods!== false) {     echo"Available digest methods: ";     echoimplode(", ", $digest_methods); } else{     echo"No digest methods available."; } ?> | 
Output:
Available digest methods: blake2b512, blake2s256, md4, md5, md5-sha1, ripemd160, sha1, sha224, sha256, sha3-224, sha3-256, sha3-384, sha3-512, sha384, sha512, sha512-224, sha512-256, shake128, shake256, sm3, whirlpool
Reference: https://www.php.net/manual/en/function.openssl-get-md-methods.php
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
 
				 
					


