code: public void execute() throws IOException, NoSuchAlgorithmException {
          if (src == null) {
              throw new IllegalArgumentException("Please provide a file to verify");
          }
          if (algorithm == null) {
              throw new IllegalArgumentException("Please provide the algorithm to "
                      + "use to calculate the checksum");
          }
          if (checksum == null) {
              throw new IllegalArgumentException("Please provide a checksum to verify against");
          }
          
          // calculate file's checksum
          MessageDigest md = MessageDigest.getInstance(algorithm);
          FileInputStream fis = new FileInputStream(src);
          String calculatedChecksum;
          try {
              byte[] buf = new byte[1024];
              int read = 0;
              while ((read = fis.read(buf)) != -1) {
                  md.update(buf, 0, read);
              }
              calculatedChecksum = toHex(md.digest());
          } finally {
              fis.close();
          }
          
          // verify checksum
          if (!calculatedChecksum.equalsIgnoreCase(checksum)) {
              throw new GradleException("Invalid checksum for file '" +
                      src.getName() + "'. Expected " + checksum.toLowerCase() + 
                      " but got " + calculatedChecksum.toLowerCase() + ".");
          }
      }
docs: Starts verifying
  @throws IOException if the file could not verified
  @throws NoSuchAlgorithmException if the given algorithm is not available