sha1
Calculate the sha1 hash of a string
Syntax
sha1 ( string $str [, bool $raw_output = FALSE ] ) : string
Parameters
str
The input string.
raw_output
If the optional raw_output is set to TRUE, then the sha1 digest is instead returned in raw binary format with a length of 20, otherwise the returned value is a 40-character hexadecimal number.
Return
Returns the sha1 hash as a string.
Examples
str
<? $str = 'Hello'; $return = sha1($str); echo $return; ?>
f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0
raw_output
<? $str = 'Hello'; $raw_output = true; $return = sha1($str, $raw_output); $unpack = unpack('H*', $return); $array_pop = array_pop($unpack); echo $array_pop; ?>
f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0