illustrate
1. In many download sites, the Hash value of the downloaded file will be provided for verification and comparison to determine whether the downloaded file is complete and identical. This is the application of file Hash.
2. After extracting the file content and performing Hash hashing, the information summary about the file is obtained. Of course, this set of functions is also perfectly supported in PHP.
Example
/file HASH echo hash_file('md5', './create-phar.php'), PHP_EOL; echo md5_file('./create-phar.php'), PHP_EOL; //ba7833e3f6375c1101fb4f1d130cf3d3 //ba7833e3f6375c1101fb4f1d130cf3d3 echo hash_hmac_file('md5', './create-phar.php', 'secret'), PHP_EOL; // 05d1f8eb7683e190340c04fc43eba9db
The above is the use of PHP file Hash, I hope it will be helpful to everyone.