PHP function of the day: sha1()

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 />”;



See the output


As you can see, this function just outputs a sha1 hash of the input. 🙂

Leave a Reply

Your email address will not be published.