ctrlbrk Posted November 1, 2010 Share Posted November 1, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/217415-sha-of-a-file/ Share on other sites More sharing options...
trq Posted November 1, 2010 Share Posted November 1, 2010 I'm no cryptography expert but, there is always hash_file. Quote Link to comment https://forums.phpfreaks.com/topic/217415-sha-of-a-file/#findComment-1128852 Share on other sites More sharing options...
ctrlbrk Posted November 1, 2010 Author Share Posted November 1, 2010 I'm no cryptography expert but, there is always hash_file. Perfect, not sure how I missed that one. Quote Link to comment https://forums.phpfreaks.com/topic/217415-sha-of-a-file/#findComment-1128859 Share on other sites More sharing options...
gizmola Posted November 1, 2010 Share Posted November 1, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/217415-sha-of-a-file/#findComment-1128870 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.