code: public static HashingInputStream createHashingStream( String digestName,
                                                            InputStream inputStream ) throws NoSuchAlgorithmException {
          MessageDigest digest = MessageDigest.getInstance(digestName);
          return new HashingInputStream(digest, inputStream);
      }
docs: Create an InputStream instance that wraps another stream and that computes the secure hash (using the algorithm with the
  supplied name) as the returned stream is used. This can be used to compute the hash of a stream while the stream is being
  processed by another reader, and saves from having to process the same stream twice.
  
  @param digestName the name of the hashing function (or {@link MessageDigest message digest}) that should be used
  @param inputStream the stream containing the content that is to be hashed
  @return the hash of the contents as a byte array
  @throws NoSuchAlgorithmException