For day 21 of 21 in the “PHP Function of the day” series, I’m going to look at sha1(). This is similar to the md5() function that we looked at on day 12. I’ll start by saying that sha1 isn’t great and should not be used for storing password hashes.
Let’s take a look.
$stringToHash = “Joe was here”;
$otherStringToHash = “Joe is here”;
echo sha1($stringToHash).”<br />”;
echo sha1($otherStringToHash).”<br />”;
As you can see, this function just outputs a sha1 hash of the input. 🙂