import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5 { public static void main(String args[]) throws UnsupportedEncodingException, NoSuchAlgorithmException { if (args.length != 1) { System.err.println("Parameter(s): "); System.exit(1); } String msg = args[0]; MessageDigest md5 = MessageDigest.getInstance("MD5"); byte hash[] = md5.digest(msg.getBytes()); for (byte b : hash) { System.out.printf("%x ", b); } System.out.println(); } }