Jump to content

sha of a file


ctrlbrk

Recommended Posts

Hi,

 

I need to get the sha of a file on the local filesystem. An absolute requirement is the returned hash must be unique under every possible circumstance --- even with millions and millions of files the hash must mean the contents of the file are identical.  I do not want to look at the time stamps, only the contents are important.

 

I am unsure if sha1() is sufficient to meet these requirements.  If it is not, there is not an sha256 or sha512 function that I could find that will hash a file directly.

 

I could use some help as to the most efficient way to do this.

 

Thx

Link to comment
https://forums.phpfreaks.com/topic/217415-sha-of-a-file/
Share on other sites

Based on what you are planning to use it for, sha1 or md5 would be fine.  The concerns that people have with those algorithms concern the uses of hashes for passwords, and that is not a problem for your application, at least from the information you provided. 

Link to comment
https://forums.phpfreaks.com/topic/217415-sha-of-a-file/#findComment-1128870
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.