PHP md5() function

PHP md5() function is used to generate the MD5 hash of a string. It returns the hash as a 32 character hexadecimal number. The md5() function uses the RSA DATA security, MD5 Message-Digest Algorithm. PHP md5() is predefined function.

Syntax :

md5(string,binary) ;

Parameter Values,

string : Required. It  takes a string.
binary : Optional. Specifies hex or binary output format.
            TRUE - Raw 16 character binary format
            FALSE - Default. 32 character hex number

md5() function returns encrypted string. We can not get decrypted value of encrypted string returned by md5() function.

Let's see below example to understand md5() function.

 

Example :

<?php
$hex = md5("aryatechno");
echo "<br>It returns 32 character hex number :".$hex; // display MD5 hash of a string

$hex = md5("aryatechno",TRUE); // binary parameter is TRUE
echo "<br>It returns Raw 16 character binary format :".$hex; // display MD5 hash of a string

?>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

43307