You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/10/03 17:02:40 UTC

DO NOT REPLY [Bug 23593] New: - Add DigestUtils facade around java.security.MessageDigest

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23593>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23593

Add DigestUtils facade around java.security.MessageDigest

           Summary: Add DigestUtils facade around
                    java.security.MessageDigest
           Product: Commons
           Version: 2.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Lang
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: apache@dave.dribin.org


Using the java.security.MessageDigest class to generate MD5 and SHA hashes are
harder to use than they need to be for creating simple digests.  Also, it
returns the digest as an array of bytes, where often a hex string is needed.  A
DigestUtils class that contains the following interface would be helpful:

    public static String md5Hex(String data)
    public static String md5Hex(byte[] data)
    public static byte[] md5(String data)
    public static byte[] md5(byte[] data)

    public static String shaHex(String data)
    public static String shaHex(byte[] data)
    public static byte[] sha(String data)
    public static byte[] sha(byte[] data)

The checked exceptions thrown by the MessageDigest factory are converted into
runtime exceptions.

As brought up in the mailing list, this may fall under Commons Codec.  IMHO,
this isn't really an encoder and decoder, and more of a facade around core Java
classes.  But either way, it seems it should fall under some Commons project as
it seems quite useful outside of my current project.

http://www.mail-archive.com/commons-user@jakarta.apache.org/msg04418.html

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org