as the java-ish pseudo-code, since you can independently search the API for OpenSSL or BSafe or the Java Crypto API ...
Buffered reader = ...;
char [MY_ARRAY_SIZE] buf = ...;
while (true) {
int count = reader.read (buf, 0, buf.length);
if (count == -1) {break};
/ * You'll need to check for the right API and handle errors yourself * /
md5.add (buf, count);
sha256.add (buf, count);
}
String md5sum = base64 (md5.finalize ()); // assumes an appropriate base64 method
String sha256sum = base64 (sha256.finalize ());
source share