PHP.nl

sha1_file

sha1_file

Calculate the sha1 hash of a file

 **sha1_file** string $filename bool $binary

Calculates the sha1 hash of the file specified by using the , and returns that hash. The hash is a 40-character hexadecimal number. filenameUS Secure Hash Algorithm 1

filenameThe filename of the file to hash.

binaryWhen true, returns the digest in raw binary format with a length of 20.

Returns a string on success, false otherwise.

Voorbeeld: example

<?php
foreach (glob('/examples/*.xml') as $ent)
{
    if (is_dir($ent)) {
        continue;
    }

    echo $ent . ' (SHA1: ' . sha1_file($ent) . ')', PHP_EOL;
}
?>

hash_file``hash_init``sha1