© Fu Cheng 2018
Fu ChengExploring Java 9https://doi.org/10.1007/978-1-4842-3330-6_13

13. Security

Fu Cheng
(1)
Auckland, New Zealand
 
This chapter covers changes related to security in Java 9.

SHA-3 Hash Algorithms

Java 9 adds four SHA-3 ( https://en.wikipedia.org/wiki/SHA-3 ) hash algorithms to generate message digest: SHA3-224, SHA3-256, SHA3-384, and SHA3-512. Listing 13-1 shows an example of how to use the algorithm SHA3-224 to generate a message digest.
import org.apache.commons.codec.binary.Hex;
public class SHA3 {
  public static void main(final String[] args) throws NoSuchAlgorithmException {
    final MessageDigest instance = MessageDigest.getInstance("SHA3-224");
    final byte[] digest = instance.digest("".getBytes());
    System.out.println(Hex.encodeHexString(digest)); ...

Get Exploring Java 9: Build Modularized Applications in Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.