python - Can I use MD5 or SHA1 hashes for filenames? -
let's consider site users can upload files. can use md5 or sha1 hashes of contents filenames? if not, should use? avoid collisions.
you can use filename, minus reserved characters. particular choices tell nothing file itself, aside hash value. provided aren't uploading identical files, should prevent file naming collisions. if don't care that, have @ it.
usually people upload files in order pull them down. you'd need have descriptor of kind; otherwise users need open mass of files 1 want. perhaps better option let user select name (up character limit) , append datetime code. then, in order have collision, you'd need have 2 users select exact same name @ exact same time. include seconds in datetime code, , chances of collision approach (but never equal) zero.
Comments
Post a Comment