sha1
sha1
Calculate the sha1 hash of a string
string **sha1** string $string bool $binary
Calculates the sha1 hash of using the
.
stringUS Secure Hash Algorithm 1
stringThe input string.
binary
If the optional 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.
binary
Returns the sha1 hash as a string.
Voorbeeld: A example
<?php
$str = 'apple';
if (sha1($str) === 'd0be2dc421be4fcd0172e5afceea3970e2f3d940') {
echo "Would you like a green or red apple?";
}
?>
hash``password_hash