code: public static MessageDigest getMessageDigest(SignatureParamSpec spec) {
          MessageDigest result;
  
          try {
              String provider = spec.getProvider();
              if (provider != null) {
                  result = MessageDigest.getInstance(spec.getHashAlg(), provider);
              } else {
                  result = MessageDigest.getInstance(spec.getHashAlg());
              }
          } catch (NoSuchAlgorithmException e) {
              throw new RuntimeException(e);
          } catch (NoSuchProviderException e) {
              throw new RuntimeException(e);
          }
  
          return result;
      }
docs: ----- some interface stuff ---------------------------------------------