class DigestVerifierImpl implements DigestVerifier {

    @Override
    public boolean verify(String digestFromRequest, String body) {
        if (StringUtils.isBlank(digestFromRequest)) {
            return false;
        }

        return handleHashAlgorithm(digestFromRequest)
                   .map(alg -> buildDigest(body, alg))
                   .map(dg -> digestFromRequest.equals(dg.getHeaderValue()))
                   .orElse(false);
    }

}