PHP - MD5

string md5 ( string $str [, bool $raw_output = false ] )
output of md5 function will returns the hash as a 32-character hexadecimal number. But if you set $raw_output = true , output will return in binary format with a length of 16.
Example #1:
$str = 'tmvh:partner01:12345';
$output_md5 = md5($str);
echo $output_md5; //output is "3d5e420dc4eaaef230409fad5662e825"
Example #2:
$str = 'tmvh:partner01:12345';
$output_md5 = md5($str,true); //$output_md5 contain binary format
//Convert $md5_output binary format to BASE64
$output_base64 = base64_encode($output_md5);
echo $output_base64; //output is "PV5CDcTqrvIwQJ+tVmLoJQ=="

Popular posts from this blog

SAP CPI - Loop Process Call with SuccessFactor (oData V2)

Setting IntelliJ IDEA to run Groovy Script

C# - BASE64 to Image