PHP string sha1_file() FunctionThe sha1_file() function is predefined PHP string function. It is used to calculate the SHA-1 hash of a file. It uses he US secure Hash Algorithm 1 and calculate the ha1 hash US secure Hash Algorithm 1. The hash is a 40 character hexadecimal number. It returns the calculated SHA-1 hash on success or False on failure. Syntax:
Example 1Save it: "test.txt" Save it: test.php Output: Your filename is:test.txt By using sha1_file() function:a02e266c6f3a8ff0c4250e502828c4ebf179d252 Example 2Save it: "test.txt" Save it: "sha1file.txt" Save it: "index.php" Save it: "test.php " Output: The file is ok. Note: If "test.txt" has been changed (that is if the SHA-1 hash has been changed):
Next TopicPHP String
|