DataUtil { public static String encrypt(final String password) { StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); EnvironmentStringPBEConfig config = new EnvironmentStringPBEConfig(); config.setAlgorithm(ALGORITHM); config.setPassword(SITE_WIDE_SECRET); encryptor.setConfig(config); return encryptor.encrypt(password); }  static String md5For16(final String msg); static String md5(final String msg); static byte[] base64Decode(final String content); static String base64Encode(final byte[] content); static String encryptPassowrd(final String rawPassword); static boolean matchPassword(final CharSequence rawPassword, final String password); static String encrypt(final String password); static String decrypt(final String password); static String byte2HexStr(final byte[] bs); static byte[] hexStr2Byte(final String hex);  }
@Test public void encrypt() { String str1 = "123456"; String str2 = DataUtil.encrypt(str1); String str3 = DataUtil.decrypt(str2); Assert.equals(str1, str3, ErrorCodeDef.SYSTEM_ERROR_10001); }