Class HashUtils
The set is declared here rather than inherited from BomUtils.calculateHashes(File, Version) so that a
cyclonedx-core-java upgrade cannot silently move the SBOM Output Contract. See ADR 0007.
The schema-dependent part of the set is decided by SchemaVersion rather than by comparing Core's
Version directly, per ADR 0006.
The SHA3 family is filtered by availability because Java 8 ships no SHA3 provider. Core 12.1.0 replaced the defensive acquisition that used to skip those algorithms with one that throws, which aborts SBOM generation outright on a Java 8 build JVM. Only SHA3 is filtered: the remaining algorithms are requested unguarded, so a build JVM that cannot provide them still fails loudly instead of emitting an SBOM whose missing hashes are indistinguishable from ones the schema never asked for.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.cyclonedx.model.Hash.Algorithm> selectAlgorithms(org.cyclonedx.Version schemaVersion) Selects the algorithms available to this build JVM for the given schema version.
-
Constructor Details
-
HashUtils
public HashUtils()
-
-
Method Details
-
selectAlgorithms
public static List<org.cyclonedx.model.Hash.Algorithm> selectAlgorithms(org.cyclonedx.Version schemaVersion) Selects the algorithms available to this build JVM for the given schema version.- Parameters:
schemaVersion- the CycloneDX schema version the SBOM is generated against- Returns:
- the algorithms to request hashes for, in the order they are computed
-