2

I've a chunk upload system that allows people to upload a file in chunk. Now, at the end of the process I want to provide the md5 or sha1 of the whole file.

md5/sha1 have the property update which should work great in case of chunks, you just need to update(content_of_the_chunk) for every chunk.

The problem is: where and how I should store the md5/sha1 object?

I'm using django, and i've several machine that handle the request. Such that I can't store the object in the session or in memory. I should put it in the database, but in the db I can only put the hexdigest (or a string) that then I can't sum or convert back to be used to do the update. How can I do?

EsseTi
  • 4,079
  • 5
  • 36
  • 63
  • Why can't you convert the hex string back to a number? – Selcuk Jan 17 '17 at 09:45
  • how? the only output that i've are digest, and from the digest you can't recompose back the text, thus it should not be able to go back and use the method `update` but maybe i'm wrong. – EsseTi Jan 17 '17 at 09:47
  • Do the answers to http://stackoverflow.com/q/1131220/621690 help? If you cannot use a shared file system/db then you might have to load the chunks into something like Redis or shared memory or similar. – Risadinha Jan 17 '17 at 10:03
  • which answer exactly? even with redis, what kind of data should i store? (the md5/sha1 does not support pickle) – EsseTi Jan 17 '17 at 10:05

0 Answers0