PHP md5

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : md5() function

Description

The md5() function is used to calculate the md5 hash (the hash as a 32-character hexadecimal number ) of a string.

Version

(PHP 4 and above)

Syntax

md5(input_string, raw_output)

Parameter

Name

Description

Required /
Optional

Type

input_string

The input string.

Required

Float

raw_output

Refers hex or binary output format, Returns raw 16-bit binary format if raw_output sets TRUE and return 32-bit hex format for setting FALSE (default).

Optional

Boolean

Return value

Returns the hash as a 32-character hexadecimal number.

Value Type : String.

Pictorial Presentation

php-string-md5()

Example 

  1. $input_string = 'Good Morning';  

  2. echo 'Original string : '.$input_string.'
    ';  

  3. echo '16 bit binary format : '.md5($input_string, TRUE).'
    ';  

  4. echo '32 bit binary format : '.md5($input_string).'
    ';  

  5. ?>  

Output :

Original string : Good Morning
16 bit binary format : r y†” du?Û£¿ân
32 bit binary format : 72a079088694099d64753fdba3bfe26e