SHA converts a string into a hash value in 40-bit hexadecimal number. Checksums are one-way encryption to check the accuracy of input.
SHA stands for the "Secure Hash Algorithm,".
PHP sha1() Function has the following syntax.
string sha1 ( string str [, bool raw_output] )
If the optional second parameter is true, the SHA1 checksum is in raw binary format whose length is 20.
PHP sha1() Function returns the SHA1 hash value for a string.
<?PHP
print sha1("hello") . "\n";
print sha1("Hello") . "\n";
print sha1("hello") . "\n";
print sha1("This is from java2s.com");
?>
sha1()
will always give the same output for a given input.
The code above generates the following result.