PHP md5() function

The md5() function calculate the md5 hash of a string

Syntax

md5 ( string $string ,raw_output=FALSE) : string

Parameters

Parameter Name Descrption
$string Required, The string.
raw_output Optional, Specifies the raw_output for hex or binary format
  • TRUE - Raw 16 bit binary format
  • FALSE(Default) - 32-character hexadecimal number

Return Value

When TRUE - Raw 16 bit binary format, When FALSE- 32 character hexadecimal number

md5() examples

echo md5('test');
//Output :: 098f6bcd4621d373cade4e832627b4f6

if(md5('test')=='098f6bcd4621d373cade4e832627b4f6')
 echo 1;
else
 echo 0;

Related Functions

  • sha1_file(): Calculate the sha1 hash of a file
  • crc32(): Calculates the crc32 polynomial of a string
  • crypt(): One-way string hashing
  • md5_file(): Calculates the md5 hash of a given file
  • sha1(): Calculate the sha1 hash of a string