sha1() and md5() Functions
With PHP, sha1() and md5() password functions are used in many web applications where passwords are implemented; such as scripts with login and logout functionality. In the modern era, sha1 is often used while md5 can be found in older and some modern applications.
By default, the sha1 function outputs a 40 character string while the md5 string is 32 characters. If you use the functions with the 'true' parameter, its cuts down the characters in half; thus sha1 is 40 characters and md5 is 16 characters. With the longer character string, it is a hexadecimal number while the shorter string is a binary number.
echo sha1('string_name'); //40 characters echo sha1('string_name, true); //20 characters
echo md5('string_name'); //32 characters echo md5('string_name', true); //16 characters