Skip to content

Commit 8e1667f

Browse files
committed
[CODEC-213] Support JEP 287: SHA-3 Hash Algorithms.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1744344 13f79535-47bb-0310-9956-ffa450edef68
1 parent 8bb467a commit 8e1667f

1 file changed

Lines changed: 48 additions & 2 deletions

File tree

src/main/java/org/apache/commons/codec/digest/MessageDigestAlgorithms.java

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@
2525
* <p>
2626
* This class is immutable and thread-safe.
2727
* </p>
28-
*
28+
* <p>
29+
* Java 8 and up: SHA-224.
30+
* </p>
31+
* <p>
32+
* Java 9 and up: SHA3-224, SHA3-256, SHA3-384, SHA3-512.
33+
* </p>
34+
*
2935
* @see <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html">Java Cryptography
3036
* Architecture Standard Algorithm Name Documentation</a>
3137
* @since 1.7 // * @deprecated Use the enum {@link MessageDigestAlgorithm}.
@@ -74,14 +80,54 @@ public class MessageDigestAlgorithms {
7480
*/
7581
public static final String SHA_512 = "SHA-512";
7682

83+
/**
84+
* The SHA3-224 hash algorithm defined in the FIPS PUB 180-4.
85+
* <p>
86+
* Present in Oracle Java 9.
87+
* </p>
88+
*
89+
* @since 1.11
90+
*/
91+
public static final String SHA3_224 = "SHA3_224";
92+
93+
/**
94+
* The SHA3-256 hash algorithm defined in the FIPS PUB 180-4.
95+
* <p>
96+
* Present in Oracle Java 9.
97+
* </p>
98+
*
99+
* @since 1.11
100+
*/
101+
public static final String SHA3_256 = "SHA3-256";
102+
103+
/**
104+
* The SHA3-384 hash algorithm defined in the FIPS PUB 180-4.
105+
* <p>
106+
* Present in Oracle Java 9.
107+
* </p>
108+
*
109+
* @since 1.11
110+
*/
111+
public static final String SHA3_384 = "SHA3-384";
112+
113+
/**
114+
* The SHA3-512 hash algorithm defined in the FIPS PUB 180-4.
115+
* <p>
116+
* Present in Oracle Java 9.
117+
* </p>
118+
*
119+
* @since 1.11
120+
*/
121+
public static final String SHA3_512 = "SHA3-512";
122+
77123
/**
78124
* Gets all constant values defined in this class.
79125
*
80126
* @return all constant values defined in this class.
81127
* @since 1.11
82128
*/
83129
public static String[] values() {
84-
return new String[] { MD2, MD5, SHA_1, SHA_224, SHA_256, SHA_384, SHA_512 };
130+
return new String[] { MD2, MD5, SHA_1, SHA_224, SHA_256, SHA_384, SHA_512, SHA3_224, SHA3_256, SHA3_384, SHA3_512 };
85131
}
86132

87133
private MessageDigestAlgorithms() {

0 commit comments

Comments
 (0)