code: public static byte[] getHash( String digestName,
                                    byte[] content ) throws NoSuchAlgorithmException {
          MessageDigest digest = MessageDigest.getInstance(digestName);
          assert digest != null;
          return digest.digest(content);
      }
docs: Get the hash of the supplied content, using the digest identified by the supplied name.
  
  @param digestName the name of the hashing function (or {@link MessageDigest message digest}) that should be used
  @param content the content to be hashed; may not be null
  @return the hash of the contents as a byte array
  @throws NoSuchAlgorithmException if the supplied algorithm could not be found