public static String encrypt(String key, String plainText){ ? String encryptTxt = ""; ? { ? ? ?byte[] salt = new byte[8];? ??? ???. ? ? ?MessageDigest md = MessageDigest.getInstance("MD5"); ? ? ?md.update(key.getBytes()); ? ? ????[] ????? = md.digest(); ? ? ?for (int i = 0; i < 8; i++) { ? ? ? ? salt[i] = ?????[i]; ? ? ?} ? ? ?PBEKeySpec pbeKeySpec = new PBEKeySpec(key.toCharArray()); ? ? ?SecretKeyFactory keyFactory = SecretKeyFactory ? ? ? ? ? ?.getInstance("PBEWithMD5AndDES"); ? ? ?SecretKey skey = keyFactory.generateSecret(pbeKeySpec); ? ? ?PBEParameterSpec paramSpec = new PBEParameterSpec(salt, ITERATIONS); ? ? ??? ?? = Cipher.getInstance("PBEWithMD5AndDES"); ? ? ?cipher.init(Cipher.ENCRYPT_MODE, skey, paramSpec); ? ? ?byte[] cipherText = cipher.doFinal(plainText.getBytes()); ? ? ?String saltString = new String(Base64.encode(salt)); ? ? ?String ciphertextString = new String(Base64.encode(cipherText)); ? ? ?saltString + ciphertextString? ?????. ? } catch (?? e) { ? ? ?e.printStackTrace(); ? } ? return "";}將這段java 加密使用PHP進(jìn)行解密