1

I wish to generate an MD5 hash of a very large file using MessageDigest.

However, because the file is so big, i never have access to the complete stream of bytes. I only have access to N segments of the file. (Processed using multipart uploads).

In fact, the segments are processed on multiple servers, so i can't pass a MessageDigest instance around from segment to segment.

I can generate an MD5 hash of each of the segments, and I know the order in which the segments will be reassembled into the final file.

Is there a way to combine the MD5 hashes of the segments, to get the true MD5 of the entire file? (The segments are combined in the database with DBMS_LOB.APPEND.) I suppose i could try writing some heinous PL/SQL to calculate it thru a stored procedure, but trying to avoid that.

MeBigFatGuy
  • 28,272
  • 7
  • 61
  • 66
  • Just keep calling `update()` with the new data as you get it, and `digest()` when you are done. Just as it says in the [Javadoc](https://docs.oracle.com/javase/8/docs/api/java/security/MessageDigest.html). – user207421 Mar 15 '21 at 03:34
  • you misread the question. the parts are on different servers. so you don't have just one MessageDigest object – MeBigFatGuy Mar 15 '21 at 12:59
  • Well you've going to have to change that. – user207421 Mar 15 '21 at 23:39

0 Answers0