import java.security.MessageDigest; public class LSMD5Encoder { public static void main(String[] args) throws Exception { if(args.length != 1) { System.err.println("Usage : LSMD5Encoder passord_to_encode"); System.exit(1); } String password = args[0]; System.out.println("LS password hash for '" + password + "' = " + digest(password)); } public static String digest(String password) throws Exception { try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(password.getBytes("UTF-8")); byte[] md5 = digest.digest(); String sReturnMsg = ""; for (int i = 0; i < md5.length; i++) { sReturnMsg += Integer.toHexString(md5[i]); } return sReturnMsg; } catch (Exception e) { throw e; } } }