Skip to end of metadata
Go to start of metadata

If you want to make a simple logic to get hash value for file, hash_file() gives you a straightforward solution.Example using hash_file()

<?php
/* Create a file to calculate hash of */
file_put_contents('example.txt', 'The quick brown fox jumped over the lazy dog.');

echo hash_file('md5', 'example.txt');
?>

The below is the output for above

5c6ffbdd40d9556b73a21e63c3e0e904