code: private static Set getCryptoImpls(String serviceType) {
      Set result = new TreeSet();
  
      // All all providers
      Provider[] providers = Security.getProviders();
      for (int i = 0; i < providers.length; i++) {
        // Get services provided by each provider
        Set keys = providers[i].keySet();
        for (Object okey : providers[i].keySet()) {
          String key = (String) okey;
          key = key.split(" ")[0];
  
          if (key.startsWith(serviceType + ".")) {
            result.add(key.substring(serviceType.length() + 1));
          } else if (key.startsWith("Alg.Alias." + serviceType + ".")) {
            // This is an alias
            result.add(key.substring(serviceType.length() + 11));
          }
        }
      }
      return result;
    }
docs: Provides a list of algorithms for the specified service (which, for our purposes, is
  "MessageDigest".
  
  <p>This method was only very slightly adapted (to use a TreeSet) from the Java Almanac at
  http://javaalmanac.com/egs/java.security/ListServices.html
  
  @param serviceType The name of the service we're looking for. It's "MessageDigest"