tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1377824 - /tomcat/trunk/test/org/apache/catalina/authenticator/TestDigestAuthenticator.java
Date Mon, 27 Aug 2012 20:21:22 GMT
Author: markt
Date: Mon Aug 27 20:21:21 2012
New Revision: 1377824

URL: http://svn.apache.org/viewvc?rev=1377824&view=rev
Log:
Take advantage of new ConcurrentMessageDigest

Modified:
    tomcat/trunk/test/org/apache/catalina/authenticator/TestDigestAuthenticator.java

Modified: tomcat/trunk/test/org/apache/catalina/authenticator/TestDigestAuthenticator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/authenticator/TestDigestAuthenticator.java?rev=1377824&r1=1377823&r2=1377824&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/authenticator/TestDigestAuthenticator.java (original)
+++ tomcat/trunk/test/org/apache/catalina/authenticator/TestDigestAuthenticator.java Mon Aug
27 20:21:21 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.catalina.authenticator;
 
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -36,6 +34,7 @@ import org.apache.catalina.startup.TestT
 import org.apache.catalina.startup.TesterServlet;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.catalina.util.ConcurrentMessageDigest;
 import org.apache.catalina.util.MD5Encoder;
 import org.apache.tomcat.util.buf.ByteChunk;
 
@@ -310,7 +309,7 @@ public class TestDigestAuthenticator ext
      */
     private static String buildDigestResponse(String user, String pwd,
             String uri, String realm, String nonce, String opaque, String nc,
-            String cnonce, String qop) throws NoSuchAlgorithmException {
+            String cnonce, String qop) {
 
         String a1 = user + ":" + realm + ":" + pwd;
         String a2 = "GET:" + uri;
@@ -361,11 +360,8 @@ public class TestDigestAuthenticator ext
         return auth.toString();
     }
 
-    private static String digest(String input) throws NoSuchAlgorithmException {
-        // This is slow but should be OK as this is only a test
-        MessageDigest md5 = MessageDigest.getInstance("MD5");
-
-        md5.update(input.getBytes());
-        return MD5Encoder.encode(md5.digest());
+    private static String digest(String input) {
+        return MD5Encoder.encode(
+                ConcurrentMessageDigest.digestMD5(input.getBytes()));
     }
 }



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


Mime
View raw message