tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1377856 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/util/ConcurrentMessageDigest.java
Date Mon, 27 Aug 2012 20:56:11 GMT
Author: markt
Date: Mon Aug 27 20:56:10 2012
New Revision: 1377856

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

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1377811

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java?rev=1377856&r1=1377855&r2=1377856&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/util/ConcurrentMessageDigest.java Mon Aug
27 20:56:10 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<String,Queue<MessageDigest>>();
 
@@ -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