byte[] salt = args[0].substring(0, 8).getBytes();
int count = Integer.parseInt(args[1]);
char[] password = "somearbitrarycrazystringthatdoesnotmatter".toCharArray();
byte[] passwordToEncode = args[2].getBytes("UTF-8");
PBEParameterSpec cipherSpec = new PBEParameterSpec(salt, count);
PBEKeySpec keySpec = new PBEKeySpec(password);
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBEwithMD5andDES");
SecretKey cipherKey = factory.generateSecret(keySpec);
String encodedPassword = encode64(passwordToEncode, "PBEwithMD5andDES",
cipherKey, cipherSpec);
System.err.println("Encoded password: MASK-"+encodedPassword);