Class Sha256
java.lang.Object
network.ike.plugin.scaffold.Sha256
SHA-256 hash utility for scaffold checksums.
Produces values in the canonical lockfile form
"sha256:" + lowercase-hex-digest. All scaffold lockfile and
manifest hashes must flow through this class so the algorithm label
stays consistent.
Hashes are computed over the raw byte content of the file or string. Consumers that need line-ending normalisation must do so before calling this class.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCompare a known hash to the current hash of a file.static Stringof(byte[] data) Hash a byte array.static StringHash a string using UTF-8 encoding.static StringHash the bytes of a file, streaming so large files don't load into memory all at once.
-
Field Details
-
PREFIX
Prefix distinguishing this algorithm in a lockfile value.- See Also:
-
-
Method Details
-
of
Hash a byte array.- Parameters:
data- the bytes to hash;nullis treated as empty- Returns:
"sha256:" + hex-digest
-
of
-
ofFile
Hash the bytes of a file, streaming so large files don't load into memory all at once.- Parameters:
path- existing readable file- Returns:
"sha256:" + hex-digest- Throws:
ScaffoldException- if the file cannot be read
-
matches
-