tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1377811 - /tomcat/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java
Date Mon, 27 Aug 2012 20:01:28 GMT
Author: markt
Date: Mon Aug 27 20:01:28 2012
New Revision: 1377811

URL: http://svn.apache.org/viewvc?rev=1377811&view=rev
Log:
Add a MD5 digest method as it is the most commonly used.

Modified:
    tomcat/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java

Modified: tomcat/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java?rev=1377811&r1=1377810&r2=1377811&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java Mon Aug 27 20:01:28
2012
@@ -30,6 +30,8 @@ import java.util.concurrent.ConcurrentLi
  */
 public class ConcurrentMessageDigest {
 
+    private static final String MD5 = "MD5";
+
     private static final Map<String,Queue<MessageDigest>> queues =
             new HashMap<>();
 
@@ -38,6 +40,18 @@ public class ConcurrentMessageDigest {
         // Hide default constructor for this utility class
     }
 
+    static {
+        try {
+            // Init commonly used algorithms
+            init(MD5);
+        } catch (NoSuchAlgorithmException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    public static byte[] digestMD5(byte[] input) {
+        return digest(MD5, input);
+    }
 
     public static byte[] digest(String algorithm, byte[] input) {
 



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


Mime
View raw message