import sun.security.provider.*; public class MD5Hash { /** * Private function to turn md5 result to 32 hex-digit string */ private static String asHex (byte hash[]) { StringBuffer buf = new StringBuffer(hash.length * 2); int i; for (i = 0; i < hash.length; i++) { if (((int) hash[i] & 0xff) < 0x10) buf.append("0"); buf.append(Long.toString((int) hash[i] & 0xff, 16)); } return buf.toString(); } /** * Take a string and return its md5 hash as a hex digit string */ public static String hash(String arg) { return hash(arg.getBytes()); } /** * Non static version for VB */ public String doHash(String arg) { return hash(arg.getBytes()); } /** * Take a byte array and return its md5 hash as a hex digit string */ public static String hash(byte barray[]) { MD5 m = new MD5(); m.init(); byte[] result = m.digest(barray); return asHex(result); } public static void main(String[] args) { for(int i=0;i