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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.