Is SHA sufficient for checking file duplication? (sha1_file in PHP)

Posted by wag2639 on Stack Overflow See other posts from Stack Overflow or by wag2639
Published on 2010-02-19T03:34:57Z Indexed on 2010/05/07 21:18 UTC
Read the original article Hit count: 190

Filed under:
|
|
|

Suppose you wanted to make a file hosting site for people to upload their files and send a link to their friends to retrieve it later and you want to insure files are duplicated where we store them, is PHP's sha1_file good enough for the task? Is there any reason to not use md5_file instead?

For the frontend, it'll be obscured using the original file name store in a database but some additional concerns would be if this would reveal anything about the original poster. Does a file inherit any meta information with it like last modified or who posted it or is this stuff based in the file system?

Also, is using a salt frivolous since security in regards of rainbow table attack mean nothing to this and the hash could later be used as a checksum?

One last thing, scalability? initially, it's only going to be used for small files a couple of megs big but eventually...

Edit 1: The point of the hash is primarily to avoid file duplication, not to create obscurity.

© Stack Overflow or respective owner

Related posts about php

Related posts about md5