Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,959 questions

51,901 answers

573 users

How to calculate the sha1 hash of a file in PHP

2 Answers

0 votes
$s = sha1_file("d:\\data.txt"); 

echo $s;


/*
run:
    
8347638d14888ab9c182eacd136dac1f7fd4e158
       
*/

 



answered Jul 17, 2016 by avibootz
0 votes
foreach(glob('*.php') as $file)
{
    if(is_dir($file))
    {
        continue;
    }

    echo $file . ' (SHA1: ' . sha1_file($file) . ')' . "<br />";
}


/*
run:
    
connect.php (SHA1: 73dbf5145799c21586c6d807ca089937b165ad84)
define.php (SHA1: a26d6fcf0b777cb216d54811af7a8ef470e24872)
email.php (SHA1: f56c03790fe339482d56ed74782310e55eb75f5f)
...
       
*/

 



answered Jul 17, 2016 by avibootz

Related questions

2 answers 192 views
1 answer 169 views
1 answer 163 views
2 answers 211 views
...