public static BlobDescriptor computeDigest(JsonTemplate template, OutputStream outStream)
      throws IOException {
    WritableContents contents = contentsOut -> JsonTemplateMapper.writeTo(template, contentsOut);
    return computeDigest(contents, outStream);
  }
Utility class for computing a digest for various inputs while optionally writing to an output
stream.
jib-core/src/main/java/com/google/cloud/tools/jib/hash/Digests.java