code: public static byte[] hashPath(MessageDigest messageDigest, Path path) throws IOException {
          try (InputStream in = getRecursiveContentStream(path)) {
              return hashContent(messageDigest, in);
          }
      }
docs: Hashes a path, if the path points to a directory then hashes the contents recursively.
  @param messageDigest the digest used to hash.
  @param path the file/directory we want to hash.
  @return the resulting hash.
  @throws IOException