PHP function of the day: md5()

For day 12 of 21 in the “PHP Function of the day” series, I’m going to look at md5(). This function calculates the md5 hash of the string you supply as input.

Let’s take a look.

<?php

$input = “Joe is here”;

echo md5($input).”</br >”;

$input = “Joe was here”;

echo md5($input).”</br >”;

$input = “Joe is here”;

echo md5($input).”</br >”;

?>

 

See the output

 

As you can see, changing two characters in the string results in a completely different hash.  It’s also a one way process, so you can’t get the original input based upon the hash.

Leave a Reply

Your email address will not be published. Required fields are marked *