How to Generate md5 hash in PHP

To Generate md5 hash in PHP is an easy task by the use of in built functions. Here I am writing an example code for generating md5 hash in PHP and You can embed this code in any PHP website or even your PHP blog. The md5 is one way hash method, mostly used for calculating checksum of texts or objects.

md5 is also popular,because of its use in UNIX/LINUX password storing, as  LINUX stores password in md5 hash of actual password given by user.

Here is a small web script in php for generate md5 hash from text.




enter text here:




//md5 generate script
$str = "deafult hash";
if(isset($_POST['t1']))
{
$str = $_POST['t1'];
}
echo "
";
$md5 = md5($str);
echo "md5 hash of text is:

";
echo $md5;
//tested at skillsyard
?>

just write the text and save the file as md5.php