You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2016/05/16 20:53:33 UTC

svn commit: r1744134 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java

Author: ggregory
Date: Mon May 16 20:53:33 2016
New Revision: 1744134

URL: http://svn.apache.org/viewvc?rev=1744134&view=rev
Log:
[CODEC-211] Create enum MessageDigestAlgorithm and deprecate class MessageDigestAlgorithms. Don't need these new File APIs anymore.

Modified:
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java

Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java?rev=1744134&r1=1744133&r2=1744134&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/DigestUtils.java Mon May 16 20:53:33 2016
@@ -300,20 +300,6 @@ public class DigestUtils {
      * @return MD2 digest
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static byte[] md2(final File data) throws IOException {
-        return digest(getMd2Digest(), data);
-    }
-
-    /**
-     * Calculates the MD2 digest and returns the value as a 16 element <code>byte[]</code>.
-     *
-     * @param data
-     *            Data to digest
-     * @return MD2 digest
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.7
      */
     public static byte[] md2(final InputStream data) throws IOException {
@@ -364,20 +350,6 @@ public class DigestUtils {
      * @return MD2 digest as a hex string
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static String md2Hex(final File data) throws IOException {
-        return Hex.encodeHexString(md2(data));
-    }
-
-    /**
-     * Calculates the MD2 digest and returns the value as a 32 character hex string.
-     *
-     * @param data
-     *            Data to digest
-     * @return MD2 digest as a hex string
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.7
      */
     public static String md2Hex(final InputStream data) throws IOException {
@@ -427,20 +399,6 @@ public class DigestUtils {
      * @return MD5 digest
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static byte[] md5(final File data) throws IOException {
-        return digest(getMd5Digest(), data);
-    }
-
-    /**
-     * Calculates the MD5 digest and returns the value as a 16 element <code>byte[]</code>.
-     *
-     * @param data
-     *            Data to digest
-     * @return MD5 digest
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.4
      */
     public static byte[] md5(final InputStream data) throws IOException {
@@ -489,20 +447,6 @@ public class DigestUtils {
      * @return MD5 digest as a hex string
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static String md5Hex(final File data) throws IOException {
-        return Hex.encodeHexString(md5(data));
-    }
-
-    /**
-     * Calculates the MD5 digest and returns the value as a 32 character hex string.
-     *
-     * @param data
-     *            Data to digest
-     * @return MD5 digest as a hex string
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.4
      */
     public static String md5Hex(final InputStream data) throws IOException {
@@ -594,20 +538,6 @@ public static byte[] sha(final byte[] da
      * @return SHA-1 digest
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static byte[] sha1(final File data) throws IOException {
-        return digest(getSha1Digest(), data);
-    }
-
-    /**
-     * Calculates the SHA-1 digest and returns the value as a <code>byte[]</code>.
-     *
-     * @param data
-     *            Data to digest
-     * @return SHA-1 digest
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.7
      */
     public static byte[] sha1(final InputStream data) throws IOException {
@@ -657,20 +587,6 @@ public static byte[] sha(final byte[] da
      * @return SHA-1 digest as a hex string
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static String sha1Hex(final File data) throws IOException {
-        return Hex.encodeHexString(sha1(data));
-    }
-
-    /**
-     * Calculates the SHA-1 digest and returns the value as a hex string.
-     *
-     * @param data
-     *            Data to digest
-     * @return SHA-1 digest as a hex string
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.7
      */
     public static String sha1Hex(final InputStream data) throws IOException {
@@ -721,24 +637,6 @@ public static byte[] sha(final byte[] da
     /**
      * Calculates the SHA-224 digest and returns the value as a <code>byte[]</code>.
      * <p>
-     * Throws a <code>RuntimeException</code> on JRE versions prior to 1.8.0.
-     * </p>
-     *
-     * @param data
-     *            File to digest
-     * @return SHA-224 digest
-     * @throws IOException
-     *             On error reading from the stream
-     * @throws IllegalArgumentException thrown on JRE versions prior to 1.8.0.
-     * @since 1.11
-     */
-    public static byte[] sha224(final File data) throws IOException {
-        return digest(getSha224Digest(), data);
-    }
-
-    /**
-     * Calculates the SHA-224 digest and returns the value as a <code>byte[]</code>.
-     * <p>
      * Throws a {@link IllegalArgumentException} on JRE versions prior to 1.8.0.
      * </p>
      *
@@ -816,24 +714,6 @@ public static byte[] sha(final byte[] da
      * @throws IllegalArgumentException thrown on JRE versions prior to 1.8.0.
      * @since 1.11
      */
-    public static String sha224Hex(final File data) throws IOException {
-        return Hex.encodeHexString(sha224(data));
-    }
-
-    /**
-     * Calculates the SHA-224 digest and returns the value as a hex string.
-     * <p>
-     * Throws a {@link IllegalArgumentException} on JRE versions prior to 1.8.0.
-     * </p>
-     *
-     * @param data
-     *            Data to digest
-     * @return SHA-224 digest as a hex string
-     * @throws IOException
-     *             On error reading from the stream
-     * @throws IllegalArgumentException thrown on JRE versions prior to 1.8.0.
-     * @since 1.11
-     */
     public static String sha224Hex(final InputStream data) throws IOException {
         return Hex.encodeHexString(sha224(data));
     }
@@ -888,23 +768,6 @@ public static byte[] sha(final byte[] da
      * </p>
      *
      * @param data
-     *            File to digest
-     * @return SHA-256 digest
-     * @throws IOException
-     *             On error reading from the stream
-     * @since 1.11
-     */
-    public static byte[] sha256(final File data) throws IOException {
-        return digest(getSha256Digest(), data);
-    }
-
-    /**
-     * Calculates the SHA-256 digest and returns the value as a <code>byte[]</code>.
-     * <p>
-     * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
-     * </p>
-     *
-     * @param data
      *            Data to digest
      * @return SHA-256 digest
      * @throws IOException
@@ -968,23 +831,6 @@ public static byte[] sha(final byte[] da
      * @return SHA-256 digest as a hex string
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static String sha256Hex(final File data) throws IOException {
-        return Hex.encodeHexString(sha256(data));
-    }
-
-    /**
-     * Calculates the SHA-256 digest and returns the value as a hex string.
-     * <p>
-     * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
-     * </p>
-     *
-     * @param data
-     *            Data to digest
-     * @return SHA-256 digest as a hex string
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.4
      */
     public static String sha256Hex(final InputStream data) throws IOException {
@@ -1040,23 +886,6 @@ public static byte[] sha(final byte[] da
      * </p>
      *
      * @param data
-     *            File to digest
-     * @return SHA-384 digest
-     * @throws IOException
-     *             On error reading from the stream
-     * @since 1.11
-     */
-    public static byte[] sha384(final File data) throws IOException {
-        return digest(getSha384Digest(), data);
-    }
-
-    /**
-     * Calculates the SHA-384 digest and returns the value as a <code>byte[]</code>.
-     * <p>
-     * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
-     * </p>
-     *
-     * @param data
      *            Data to digest
      * @return SHA-384 digest
      * @throws IOException
@@ -1120,23 +949,6 @@ public static byte[] sha(final byte[] da
      * @return SHA-384 digest as a hex string
      * @throws IOException
      *             On error reading from the stream
-     * @since 1.11
-     */
-    public static String sha384Hex(final File data) throws IOException {
-        return Hex.encodeHexString(sha384(data));
-    }
-
-    /**
-     * Calculates the SHA-384 digest and returns the value as a hex string.
-     * <p>
-     * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
-     * </p>
-     *
-     * @param data
-     *            Data to digest
-     * @return SHA-384 digest as a hex string
-     * @throws IOException
-     *             On error reading from the stream
      * @since 1.4
      */
     public static String sha384Hex(final InputStream data) throws IOException {
@@ -1192,23 +1004,6 @@ public static byte[] sha(final byte[] da
      * </p>
      *
      * @param data
-     *            File to digest
-     * @return SHA-512 digest
-     * @throws IOException
-     *             On error reading from the stream
-     * @since 1.11
-     */
-    public static byte[] sha512(final File data) throws IOException {
-        return digest(getSha512Digest(), data);
-    }
-
-    /**
-     * Calculates the SHA-512 digest and returns the value as a <code>byte[]</code>.
-     * <p>
-     * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
-     * </p>
-     *
-     * @param data
      *            Data to digest
      * @return SHA-512 digest
      * @throws IOException
@@ -1261,23 +1056,6 @@ public static byte[] sha(final byte[] da
         return Hex.encodeHexString(sha512(data));
     }
 
-    /**
-     * Calculates the SHA-512 digest and returns the value as a hex string.
-     * <p>
-     * Throws a <code>RuntimeException</code> on JRE versions prior to 1.4.0.
-     * </p>
-     *
-     * @param data
-     *            File to digest
-     * @return SHA-512 digest as a hex string
-     * @throws IOException
-     *             On error reading from the stream
-     * @since 1.11
-     */
-    public static String sha512Hex(File data) throws IOException {
-        return Hex.encodeHexString(sha512(data));
-    }
-
     /**
      * Calculates the SHA-512 digest and returns the value as a hex string.
      * <p>