The sha1_file() function is used to calculate the sha1 hash of a file.
Syntax
sha1_file(file_name, raw)
Parameters
file_name − Specify the file
raw − A boolean value that specifies hex or binary output format −
TRUE - Raw 20 character binary format
FALSE - 40 character hex number
Return
The sha1_file() function returns the SHA-1 hash on success, or FALSE on failure.
Example
The following is an example −
<?php $s = "sample.txt"; $sha1file = sha1_file($s); echo $sha1file; ?>
Output
The following is the output −
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d