commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CODEC-173) DigestUtils: extend updateDigest() methods to create the final digest in various forms
Date Sat, 15 Jun 2013 20:19:20 GMT
Sebb created CODEC-173:
--------------------------

             Summary: DigestUtils: extend updateDigest() methods to create the final digest
in various forms
                 Key: CODEC-173
                 URL: https://issues.apache.org/jira/browse/CODEC-173
             Project: Commons Codec
          Issue Type: New Feature
            Reporter: Sebb


For applications that need to generate different digests, it would be useful to be able to
provide the digest as a parameter to the process.

For example:

{code}
public static byte[] digest(MessageDigest messageDigest, byte[] bytes) {
    return updateDigest(messageDigest, bytes).digest();
}
public static byte[] digest(final String algorithm, byte[] bytes) {
    return digest(getDigest(algorithm), bytes);
}
public static String digestHex(MessageDigest messageDigest, byte[] bytes) {
    return Hex.encodeHexString(updateDigest(messageDigest, bytes).digest());
}
public static String digestHex(final String algorithm, byte[] bytes) {
    return digestHex(getDigest(algorithm), bytes);
}
{code}

The same 4 methods would also be useful for InputStream (and possibly String).

There is already a private method of this form:

byte [] digest(MessageDigest digest, InputStream data) throws IOException



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message