| 1639 | } |
| 1640 | |
| 1641 | public static String md5(String protocolPassword) { |
| 1642 | MessageDigest mdEnc; |
| 1643 | try { |
| 1644 | mdEnc = MessageDigest.getInstance("MD5"); |
| 1645 | mdEnc.update(protocolPassword.getBytes(), 0, |
| 1646 | protocolPassword.length()); |
| 1647 | String md5 = new BigInteger(1, mdEnc.digest()).toString(16); |
| 1648 | return "MD5-" + md5; |
| 1649 | } catch (NoSuchAlgorithmException e) { |
| 1650 | return "PLAIN-" + protocolPassword; |
| 1651 | } |
| 1652 | |
| 1653 | } |
| 1654 | |
| 1655 | public static byte[] objectToBytes(Object object) { |
| 1656 | ByteArrayOutputStream bos = new ByteArrayOutputStream(); |