Calculate the SHA-1 hash of the text file "test.txt" in PHP

Description

The following code shows how to calculate the SHA-1 hash of the text file "test.txt".

Example


/*w  w  w . j av  a 2s . com*/
<?php
    $filename = "test.txt";
    $sha1file = sha1_file($filename);
    echo $sha1file;
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Development »




Environment
Error
Hash
Include
Locale
Math
Network
Output
Reflection
PHP Regular Expressions