The sha1_file function sets the sha1 hash a text file.

    
    $filename = "test.txt";

    $sha1file = sha1_file($filename);
    echo $sha1file;
    // aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d