code: public static String sha1(File sourceFile) throws Exception {
          byte[] buffer = new byte[1024];
          MessageDigest complete = MessageDigest.getInstance("SHA-1");
          updateDigest(complete, sourceFile, buffer);
          byte[] bytes = complete.digest();
          StringBuilder sb = new StringBuilder();
          for (byte b : bytes) {
              sb.append(String.format("%02x", b));
          }
          return sb.toString();
      }
docs: Computes the hash of a file or directory.
  
  @param sourceFile the original file or directory
  @return an hex string representing the SHA1 hash of the file or directory.
  @throws Exception if any IOException of SecurityException occured