[CODEC-210] Add DigestUtils.getDigest(String, MessageDigest) - ASF Jira (original) (raw)

Add DigestUtils.getDigest(String algo, MessageDigest):

/**
 * Returns a <code>MessageDigest</code> for the given <code>algorithm</code> or a default if there is a problem getting the algorithm.
 *
 * @param algorithm
 *            the name of the algorithm requested. See <a
 *            href="http:
 *            >Appendix A in the Java Cryptography Architecture Reference Guide</a> for information about standard
 *            algorithm names.
 * @param defaultMessageDigest The default MessageDigest.
 * @return A digest instance.
 * @see MessageDigest#getInstance(String)
 * @throws IllegalArgumentException
 *             when a {@link NoSuchAlgorithmException} is caught.
 * @since 1.11
 */