Is it possible, and if, how, to preserve the internal state of the MessageDigest object? I want to store it in a database, so I need to use only primitive data, such as String , int , byte[] .
What I'm trying to achieve is to get a fragmented file (for a long period of time), save all the fragments in the database and after receiving the last fragment, check the SHA512 digest of the file without returning all the data previously stored in the database.
So basically I want something like this:
MessageDigest md = MessageDigest.getInstance("SHA-512"); // restore previous internal state of md md.update(dataSegment); // save internal md state
source share