in enforcer-rules/src/main/java/org/apache/maven/enforcer/rules/checksum/RequireFileChecksum.java [153:169]
protected String calculateChecksum(InputStream inputStream) throws IOException, EnforcerRuleException {
String result;
if ("md5".equals(this.type)) {
result = DigestUtils.md5Hex(inputStream);
} else if ("sha1".equals(this.type)) {
result = DigestUtils.sha1Hex(inputStream);
} else if ("sha256".equals(this.type)) {
result = DigestUtils.sha256Hex(inputStream);
} else if ("sha384".equals(this.type)) {
result = DigestUtils.sha384Hex(inputStream);
} else if ("sha512".equals(this.type)) {
result = DigestUtils.sha512Hex(inputStream);
} else {
throw new EnforcerRuleError("Unsupported hash type: " + this.type);
}
return result;
}