0
  1. The server is built with Java language -netty server, using Http to provide services
  2. The server provides a file download service over Http. However, MD5 has not been computed for these files before
  3. At present, when we want to download the corresponding request through http interface, the server outputs the file stream and calculates MD5 at the same time
  4. The file is large, tens of GB, and the system disk load is limited, so I don't want to read the file multiple times to calculate MD5

I have two ideas:

  1. On the server side, get the http Response output stream, and calculate the MD5?
  2. On the server side, take the file stream and use some facet to listen to all the output, and when the file stream is closed, get the MD5

So does this work in theory? Surely the server-side MD5 calculation will be wrong if the client doesn't fully read the stream?

张SSN
  • 1
  • 1
  • Calculating the MD5 hash of a file that is being transferred is going to be a waste of time with no benefits in almost all scenarios. Just use HTTPS and don't bother with the MD5 of anything. – President James K. Polk Jul 05 '23 at 21:23

0 Answers0