PHP openssl_digest() Function Last Updated : 27 Oct, 2021 Comments Improve Suggest changes Like Article Like Report The openssl_digest() function is an inbuilt function in PHP that is used to compute a digest hash value for the given data using a given method and returns a raw or binary hex-encoded string. Syntax: openssl_digest( string $data, string $digest_algo, bool $binary = false): string|false Parameters: This function accepts four parameters as mentioned above and described below - data: The data for which digest value is to be created.digest_algo: The digest method to use, e.g. "sha256".binary: Setting to true will return as raw output data, otherwise the return value is binhex encoded. Return Values: It returns the digested hash value on success or false on failure. Below program illustrate the openssl_digest() function in PHP. Example 1: PHP <?php // Data for which digest is to be created $data = 'geeks for geeks'; // openssl_digest() with sha512 algorithm // to compute digest value true as // parameters return the raw input $fingerPrint = openssl_digest ($data , "sha512", true); // Print the output of openssl_digest output print_r($fingerPrint); ?> Output : o��P�R�:`�w�ce�V x���(�eH@\000�7��G�" Example 2: PHP <?php // Data for which digest is to be created $data = 'geeks for geeks'; // openssl_digest() with sha512 algorithm // to compute digest value false as // parameters return the hex value $fingerPrint = openssl_digest ($data , "sha512", false); // Print the output of openssl_digest output print_r($fingerPrint); ?> Output: 6e5f36e9cee5cba6ad938977c98e12f3a61fc4d944753ad130116b026b8ab2c895878910fea3b47dba6d760a20d0b23233980a8dab13f04f262c53f25222b416 Reference: https://www.php.net/manual/en/function.openssl-pkey-export.php Comment More infoAdvertise with us Next Article PHP openssl_digest() Function S Shivam.Pradhan Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-OpenSSL Similar Reads PHP openssl_pkey_export() Function The openssl_pkey_export() function is an inbuilt function in PHP which is used to view and manage private keys and public keys. It gets an exportable representation of a key into a string. It exports the key as a PEM encoded string and stores to pass by reference. Syntax: bool openssl_pkey_export( m 2 min read PHP openssl_pkcs12_export() Function The opensl_pkcs12_export() function is a built-in function in PHP which is used to store in a string called x509 in a PKCS # 12 file format. Certificate store file corresponding to PKCS # 12 variable. Syntax: bool openssl_pkcs12_export( mixed $x509, string &$out, mixed $priv_key, string $pass [, 2 min read PHP openssl_verify() Function The openssl_verify() function is an inbuilt function in PHP which is used to verifies that if the signature is correct for the specified data using the public key associated with public_key or not. This must be the public key corresponding to the private key used for signing. Syntax: openssl_verify 2 min read PHP openssl_pbkdf2() Function The openssl_pbkdf2() function is an inbuilt function in PHP that implements the Password-Based Key Derivation Function 2 (PBKDF2) algorithm provided by the OpenSSL library. The algorithm is designed to be slow and computationally intensive, making it resistant to brute-force attacks. Syntax: openssl 2 min read PHP | IntlChar digit() function The IntlChar::digit() function is an inbuilt function in PHP which is used to get the decimal digit value of a code point for a given radix. This function returns the decimal digit value of the code point in the specified radix. Syntax: int IntlChar::digit( $codepoint, $radix ) Parameters: This func 2 min read Like