/** * Generate a unique key as a byte array. * * @return A unique key as a byte array. */ public static synchronized byte[] generateBytesKey() { byte[] junk = new byte[16]; random.nextBytes(junk); String input = new StringBuffer().append(vmid).append( new java.util.Date()).append(Arrays.toString(junk)).append(counter++).toString(); return getMD5Bytes(input.getBytes()); }
/** * Return an MD5 checksum for data in hex format. * * @param data The data to checksum. * @return MD5 checksum for the data in hex format. */ public static String getMD5(byte[] data) { return toHex(getMD5Bytes(data)); }