先贴以下代码:
package com.hua.md5.test;
import java.io.*;
import java.security.*;
public class HashFile {
/**
* @param args
*/
public static char[] hexChar = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
public static void main(String[] args) {
String fileName = "F:\\soft\\Firefox.exe";
String hashType = "MD5";
try {
System.out.println(hashType + " == " + getHash(fileName, hashType));
hashType = "SHA1";
System.out.println(hashType + " == " + getHash(fileName, hashType));
hashType = "SHA-256";
System.out.println(hashType + " == " + getHash(fileName, hashType));
hashType = "SHA-384";
System.out.println(hashType + " == " + getHash(fileName, hashType));
hashType = "SHA-512";
System.out.println(hashType + " == " + getHash(fileName, hashType));
} catch (Exception e) { <