Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.skynetcomputing.skynettools; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Scanner; /** * * @author Kargathia */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { Scanner s = new Scanner(System.in); boolean isRunning = true; while (isRunning) { System.out.println("Enter file path for MD5 hash. Leave empty to quit"); String input = s.nextLine(); isRunning = !input.isEmpty(); if (isRunning) { File inputFile = new File(input); if (inputFile.length() > 0) { try (FileInputStream fis = new FileInputStream(inputFile)) { String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(fis); System.out.println("MD5: " + md5); } } } } } }