The sha1() function in PHP 8.4 and PHP 8.5 works the same as in earlier versions, but it now carries a deprecation warning in PHP 8.4. You can still use it, but PHP officially recommends switching to the more secure hash( isha1 , ...) alternative.
Functionality
The function calculates the SHA-1 hash of a string, returning a 40-character hexadecimal string by default, or a 20-byte raw binary string if the second parameter $binary is set to true.
Example
<?php
$str = apple ;// Default: 40-character hexadecimal string
echo sha1($str);
// Output: d0be2dc421be4fcd0172e5afceea3970e2f3d940// Raw binary output (20 bytes)
$raw = sha1($str, true);
echo bin2hex($raw); // Same as above, but returned as raw binary
?>