Sulitkan String statik awam(Kunci rentetan, Teks biasa String){ String encryptTxt = ""; cuba { bait[] garam = bait baharu[8]; MessageDigest md = MessageDigest.getInstance("MD5"); md.update(key.getBytes()); byte[] digest = md.digest(); untuk (int i = 0; i < 8; i++) { garam[i] = penghadaman[i]; } PBEKeySpec pbeKeySpec = PBEKeySpec baharu(key.toCharArray()); SecretKeyFactory keyFactory = SecretKeyFactory .getInstance("PBEWithMD5AndDES"); SecretKey skey = keyFactory.generateSecret(pbeKeySpec); PBEParameterSpec paramSpec = PBEParameterSpec(garam, LElaran); Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES"); cipher.init(Cipher.ENCRYPT_MODE, skey, paramSpec); byte[] cipherText = cipher.doFinal(plainText.getBytes()); Rentetan garamString = Rentetan baharu(Base64.encode(garam)); String ciphertextString = new String(Base64.encode(cipherText)); kembalikan saltString + ciphertextString; } tangkapan (Pengecualian e) { e.printStackTrace(); } kembalikan "";}将这段java 加密使用PHP进行解密