private static void digest(MessageDigest md, InputStream input) {
        try (OutputStream out = new TagOutputStream(md)) {
            byte[] buffer = new byte[1024];
            int read;
            while ((read = input.read(buffer, 0, 1024)) >= 0) {
                out.write(buffer, 0, read);
            }
        } catch(IOException xio) {
            throw new IllegalStateException(xio);
        }
    }
Updates a digest with an input stream.
@param md the digest to update
@param input the input to consume
@throws IllegalStateException if an io exception occurs
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/properties/Digester.java