You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2016/05/19 13:42:12 UTC

[jira] [Resolved] (CODEC-173) DigestUtils: extend updateDigest() methods to create the final digest in various forms

     [ https://issues.apache.org/jira/browse/CODEC-173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved CODEC-173.
------------------------
    Resolution: Won't Fix

No longer needed with the fluent interface

> 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 was sent by Atlassian JIRA
(v6.3.4#6332)