0

We are writing an Object Storage Catalog web service and allowing users to optionally send a Content-MD5 header. If they do not send the header we would like to generate one for the content that was ingested.

As the InputStream is read and saved to the data source we would like to generate an MD5 checksum. The problem is that some of our data can be as large as several hundred megabytes or possibly larger so we do not want to read the InputStream into memory to generate the MD5 checksum.

Is there some way to generate an MD5 checksum on the fly as data is read into a byte[] buffer and then streamed to the data source?

3
  • 1
    Have you at least read the javadoc of MessageDigest? It has several update() methods. Commented Jul 8, 2015 at 19:59
  • Different algorithm, but same principle: stackoverflow.com/questions/2495994/… Commented Jul 8, 2015 at 20:27
  • Perfect. I have been using java for about 6 months and had not come across MessageDigest yet. That does exactly what I want it to do. Commented Jul 9, 2015 at 13:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.