public static DescriptorDigest fromDigest(String digest) throws DigestException {
    if (!digest.matches(DIGEST_REGEX)) {
      throw new DigestException("Invalid digest: " + digest);
    }

    // Extracts the hash portion of the digest.
    String hash = digest.substring(DIGEST_PREFIX.length());
    return new DescriptorDigest(hash);
  }
Creates a new instance from a valid digest string.

@param digest the digest to generate the {@link DescriptorDigest} from
@return a new {@link DescriptorDigest} created from the digest
@throws DigestException if the digest is invalid
jib-core/src/main/java/com/google/cloud/tools/jib/api/DescriptorDigest.java