Suppose you wanted to make a site for hosting files so that people could upload their files and send a link to their friends to get them later, and you want the files to be duplicated where we store them, is PHP sha1_file suitable enough for the task? Is there a reason not to use md5_file instead?
For the external interface, it will be hidden using the original file name repository in the database, but there will be some additional problems if it opens something about the original poster. Does the file save any meta-information with it, as the last change, or who sent it, or is it material based on the file system?
In addition, the use of salt is frivolous, since security against the rainbow table attack means nothing for this, and the hash can subsequently be used as a checksum?
Last, scalability? initially it will be used only for small files of a few megabytes, but in the end ...
Edit 1: The hash point in the first place is to avoid duplicate files, and not to create obscurity.
source
share