code: public static String hash(InputStream in) {
          try {
              MessageDigest digest = MessageDigest.getInstance("sha1");
  
              ByteArrayPool.withByteArray(buffer -> {
                  try {
                      int length;
                      while ((length = in.read(buffer)) != -1) {
                          digest.update(buffer, 0, length);
                      }
                  } catch (IOException e) {
                      throw Exceptions.propagate(e);
                  }
              });
  
              return String.format("%040x", new BigInteger(1, digest.digest()));
          } catch (NoSuchAlgorithmException e) {
              throw Exceptions.propagate(e);
          }
      }
docs: Calculates the SHA-1 hash for an {@link InputStream}
  
  @param in the {@link InputStream} to calculate the hash for
  @return {@link String} representation of the hash