commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1379769 - in /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest: DigestUtils.java MessageDigestAlgorithms.java
Date Sat, 01 Sep 2012 15:18:31 GMT
Author: ggregory
Date: Sat Sep  1 15:18:31 2012
New Revision: 1379769

URL: http://svn.apache.org/viewvc?rev=1379769&view=rev
Log:
Refactor strings into a new class MessageDigestAlgorithms for public consumption.

Added:
    commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
  (with props)
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=1379769&r1=1379768&r2=1379769&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
Sat Sep  1 15:18:31 2012
@@ -97,7 +97,7 @@ public class DigestUtils {
      *             when a {@link java.security.NoSuchAlgorithmException} is caught.
      */
     public static MessageDigest getMd5Digest() {
-        return getDigest("MD5");
+        return getDigest(MessageDigestAlgorithms.MD5);
     }
 
     /**
@@ -111,7 +111,7 @@ public class DigestUtils {
      *             when a {@link java.security.NoSuchAlgorithmException} is caught.
      */
     public static MessageDigest getSha256Digest() {
-        return getDigest("SHA-256");
+        return getDigest(MessageDigestAlgorithms.SHA_256);
     }
 
     /**
@@ -125,7 +125,7 @@ public class DigestUtils {
      *             when a {@link java.security.NoSuchAlgorithmException} is caught.
      */
     public static MessageDigest getSha384Digest() {
-        return getDigest("SHA-384");
+        return getDigest(MessageDigestAlgorithms.SHA_384);
     }
 
     /**
@@ -139,7 +139,7 @@ public class DigestUtils {
      *             when a {@link java.security.NoSuchAlgorithmException} is caught.
      */
     public static MessageDigest getSha512Digest() {
-        return getDigest("SHA-512");
+        return getDigest(MessageDigestAlgorithms.SHA_512);
     }
 
     /**

Added: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java?rev=1379769&view=auto
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
(added)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
Sat Sep  1 15:18:31 2012
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.codec.digest;
+
+import java.security.MessageDigest;
+
+/**
+ * Standard {@link MessageDigest} algorithm names from the <cite>Java Cryptography
Architecture Standard Algorithm 
+ * Name Documentation</cite>.
+ * 
+ * @see <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html">Java
Cryptography
+ *      Architecture Standard Algorithm Name Documentation</a>
+ * @since 1.7
+ * @version $Id$
+ */
+public class MessageDigestAlgorithms {
+
+    /**
+     * The MD2 message digest algorithm defined in RFC 1319.
+     */
+    public static final String MD2 = "MD2";
+
+    /**
+     * The MD5 message digest algorithm defined in RFC 1321.
+     */
+    public static final String MD5 = "MD5";
+
+    /**
+     * The SHA-1 hash algorithm defined in the FIPS PUB 180-2.
+     */
+    public static final String SHA_1 = "SHA-1";
+
+    /**
+     * The SHA-256 hash algorithm defined in the FIPS PUB 180-2.
+     */
+    public static final String SHA_256 = "SHA-256";
+
+    /**
+     * The SHA-384 hash algorithm defined in the FIPS PUB 180-2.
+     */
+    public static final String SHA_384 = "SHA-384";
+
+    /**
+     * The SHA-512 hash algorithm defined in the FIPS PUB 180-2.
+     */
+    public static final String SHA_512 = "SHA-512";
+
+}

Propchange: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message