php openssl_get_md_method example

by Anish

Posted on Wednesday December 12 , 2018


openssl_get_md_methods

openssl_get_md_method: Gets available digest methods.

  • Supported PHP Versions (PHP 5 >= 5.3.0, PHP 7)

The Syntax

array  openssl_get_md_methods ([ bool  $aliases =  `FALSE` ] )
  • aliases: Set to TRUE if cipher aliases should be included within the returned array.
  • Returns An array of available digest methods.

Examples

openssl_get_md_methods() example Shows how the available digest might look, and also which aliases might be available.

<?php  
/**  
 * Created by https://8gwifi.org  
 * User: Anish Nath  
 * Date: 2018-12-12 * Time: 10:40 
 * */  
$digests = openssl_get_md_methods();  
$digests_and_aliases = openssl_get_md_methods(true);  
$digest_aliases = array_diff($digests_and_aliases, $digests);  
print_r($digests);  
print_r($digest_aliases);  
?>

The above example will output something similar to:

$ /usr/bin/php get_md_methods.php
Array
(
    [0] => DSA
    [1] => DSA-SHA
    [2] => GOST 28147-89 MAC
    [3] => GOST R 34-11-2012 (512 bit)
    [4] => GOST R 34.11-2012 (256 bit)
    [5] => GOST R 34.11-94
    [6] => MD4
    [7] => MD5
    [8] => RIPEMD160
    [9] => SHA
    [10] => SHA1
    [11] => SHA224
    [12] => SHA256
    [13] => SHA384
    [14] => SHA512
    [15] => dsaEncryption
    [16] => dsaWithSHA
    [17] => ecdsa-with-SHA1
    [18] => gost-mac
    [19] => md4
    [20] => md5
    [21] => md_gost94
    [22] => ripemd160
    [23] => sha
    [24] => sha1
    [25] => sha224
    [26] => sha256
    [27] => sha384
    [28] => sha512
    [29] => streebog256
    [30] => streebog512
    [31] => whirlpool
)
Array
(
    [2] => DSA-SHA1
    [3] => DSA-SHA1-old
    [4] => DSS1
    [12] => RSA-MD4
    [13] => RSA-MD5
    [14] => RSA-RIPEMD160
    [15] => RSA-SHA
    [16] => RSA-SHA1
    [17] => RSA-SHA1-2
    [18] => RSA-SHA224
    [19] => RSA-SHA256
    [20] => RSA-SHA384
    [21] => RSA-SHA512
    [30] => dsaWithSHA1
    [31] => dss1
    [35] => md4WithRSAEncryption
    [37] => md5WithRSAEncryption
    [39] => ripemd
    [41] => ripemd160WithRSA
    [42] => rmd160
    [45] => sha1WithRSAEncryption
    [47] => sha224WithRSAEncryption
    [49] => sha256WithRSAEncryption
    [51] => sha384WithRSAEncryption
    [53] => sha512WithRSAEncryption
    [54] => shaWithRSAEncryption
    [55] => ssl2-md5
    [56] => ssl3-md5
    [57] => ssl3-sha1
)

In openssl You can get a list of available cipher methods by calling

$ openssl list-message-digest-commands

The above example will output something similar to:

md2
md4
md5
mdc2
rmd160
sha
sha1


Thanku for reading !!! Give a Share for Support


Your Support Matters!

Instead of directly asking for donations, I'm thrilled to offer you all nine of my books for just $9 on leanpub By grabbing this bundle you not only help cover my coffee, beer, and Amazon bills but also play a crucial role in advancing and refining this project. Your contribution is indispensable, and I'm genuinely grateful for your involvement in this journey!

Any private key value that you enter or we generate is not stored on this site, this tool is provided via an HTTPS URL to ensure that private keys cannot be stolen, for extra security run this software on your network, no cloud dependency




python Cryptography Topics
Topics
For Coffee/ Beer/ Amazon Bill and further development of the project Support by Purchasing, The Modern Cryptography CookBook for Just $9 Coupon Price

Kubernetes for DevOps

Hello Dockerfile

Cryptography for Python Developers

Cryptography for JavaScript Developers

Go lang ryptography for Developers