How to Generate md5 hash in PHP

In this article we are learning that How to Generate md5 hash in PHP with a small line code.You can embed the code for generate md5 hash in PHP website or even your PHP blog. md5 is the one way hash method. It is used mostly for calculate checksum of texts or objects.

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

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

<form action="" method="post">
<p>enter text here: <input type="text" name="t1" /></p>
<p><input type="submit" /></p>
//md5 generate script
$str = "deafult hash";
$str = $_POST['t1'];
echo "<BR>";
$md5 = md5($str);
echo "md5 hash of text is: <br><br>";
echo $md5;
//tested at skillsyard

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