Re: Which hashing algorithm is best to check file duplicity?
| From: | Jan G.B. | Date: | Sun, 15 Mar 2009 21:38:44 +0000 |
| Subject: | Re: Which hashing algorithm is best to check file duplicity? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290100@lists.php.net to get a copy of this message | ||
2009/3/15 Martin Zvarík <mzvarik@gmail.com>:
> I want to store the file's hash to the database, so I can check next time to
> see if that file was already uploaded (even if it was renamed).
>
> What would be the best (= fastest + small chance of collision) algorithm in
> this case?
>
> Is crc32 a good choice?
guess not.
maybe unhex(md5()) into a binary(16) field?
What I'm trying to say is, that crc32 is more likely to have
collisions as a better algorithm like sha1, md5, ..
and that the datatype for the db should be considered.
byebye