In Java, you can use the Security.getAlgorithms("MessageDigest") to list all the available MessageDigest algorithms.

package com.favtuts.crypto.hash;

import java.security.Security;
import java.util.Set;

public class ListMessageDigest {

    public static void main(String[] args) {
        Set<String> messageDigest = Security.getAlgorithms("MessageDigest");
        messageDigest.forEach(x -> System.out.println(x));
    }
    
}

Output

SHA3-512
SHA-384
SHA
SHA3-384
SHA-224
SHA-512/256
SHA-256
MD2
SHA-512/224
SHA3-256
SHA-512
MD5
SHA3-224

P.S Tested with JDK 10.0.1

Download Source Code

$ git clone https://github.com/favtuts/java-core-tutorials-examples

$ cd java-crypto/hash

References

  1. Security.getAlgorithms JavaDoc

Leave a Reply

Your email address will not be published. Required fields are marked *