JEP 130: SHA-224 Message Digests
By Smullan-Oracle on Aug 19, 2013
JEP 130 (SHA-224 Message Digests) is one of the 11 new security features funded and targeted to JDK 8.
The SHA-2 cryptographic hash family includes the SHA-224, SHA-256, SHA-384, and SHA-512 algorithms. The JDK already includes support for SHA-256, SHA-384, and SHA-512. JEP 130 completes the JDK support for the SHA-2 family.
SHA-224 is basically a truncated version of SHA-256. The calculated hash is 224 bits (instead of 256) and is computed with a different initial value than SHA-256. It provides 112 bits of security (which is the same as two-key Triple DES). Use SHA-224 when your cryptographic application provides no more than 112 bits of security or you need the extra savings of the smaller hash size.
Here are some code examples using SHA-224:
// Create a SHA-224 java.security.MessageDigest MessageDigest md = MessageDigest.getInstance(“SHA-224”); // Create a SHA224withRSA java.security.Signature Signature sig = Signature.getInstance(“SHA224withRSA”); // Create a SHA224withECDSA java.security.Signature Signature esig = Signature.getInstance(“SHA224withECDSA”); // Create an HmacSHA224 javax.crypto.KeyGenerator KeyGenerator kg = KeyGenerator.getInstance(“HmacSHA224”); // Create an HmacSHA224 javax.crypto.Mac Mac mac = Mac.getInstance(“HmacSHA224”); // Create an RSA/ECB/OAEPWithSHA-224ANDMGF1PADDING javax.crypto.Cipher Cipher c = Cipher.getInstance(“RSA/ECB/OAEPWithSHA-224ANDMGF1PADDING”);
Early access binaries of JDK 8 can be downloaded at http://jdk8.java.net/download.html