Deployment engineering

Artifact digest comparison

Check identical bytes against trusted identity; not provenance. Executed Java 21 offline model; hosted cloud behavior not established.

Formal Syntax & Structure

java syntaxjava
MessageDigest.getInstance("SHA-256")

Working Example

Example Snippetjava
import java.nio.charset.StandardCharsets;public class Main {    static String digest(byte[] bytes) throws java.security.NoSuchAlgorithmException {        return java.util.HexFormat.of().formatHex(java.security.MessageDigest.getInstance("SHA-256").digest(bytes));    }    public static void main(String[] args) {        try {            byte[] staged="catalog-v1".getBytes(StandardCharsets.UTF_8);            byte[] production=staged.clone();            System.out.println(digest(staged).equals(digest(production)));            production[0]=0;            System.out.println(digest(staged).equals(digest(production)));        } catch (java.security.NoSuchAlgorithmException e) { throw new IllegalStateException(e); }    }}
Java Reference