commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CODEC-195) Support SHA-224 in DigestUtils on Java 8
Date Wed, 18 May 2016 13:17:12 GMT

    [ https://issues.apache.org/jira/browse/CODEC-195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15288934#comment-15288934
] 

Sebb commented on CODEC-195:
----------------------------

I don't think it makes sense to add shorthand method definitions for every new standard digest
type.
The class is becoming very unwieldy.

Rather than adding 11 methods just for SHA224, users should be encouraged to use generic methods.

This currently involves using

public static byte[] digest(MessageDigest messageDigest, byte[] data)

It would be easier to use if there were a digest method with the signature:

public static byte[] digest(String algorithm, byte[] data)

The code then becomes:

byte [] digest DigestUtils.digest(MessageAlgorithms.SHA_224, data);
instead of
byte [] digest DigestUtils.sha224(data);

However if SHA_224 is defined using a static import, one can use:

byte [] digest DigestUtils.digest(SHA_224, data);

This is not much longer, and means that the same API can be used for all digest types.


> Support SHA-224 in DigestUtils on Java 8
> ----------------------------------------
>
>                 Key: CODEC-195
>                 URL: https://issues.apache.org/jira/browse/CODEC-195
>             Project: Commons Codec
>          Issue Type: New Feature
>    Affects Versions: 1.11
>         Environment: Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
> Maven home: C:\Java\apache-maven-3.2.3
> Java version: 1.7.0_71, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_71\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>             Fix For: 1.11
>
>
> Support SHA-224 in DigestUtils on Java 8.
> The new APIs throw IllegalArgumentException on Java versions prior to Java 8.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message